Deploy Laravel 11 on Ubuntu VPS with Nginx & HTTPS (2026 Practical Guide)

Deploying Laravel 11 on an Ubuntu VPS with Nginx and HTTPS: A Practical 2026 Walkthrough

Are you ready for take your Laravel project live on the web?

If you are running a Laravel computer program on an Ubuntu VPS and want a secure, fast, and production-ready use/military service, this guide is exactly for you.

In this lesson, you will learn how to send out and use Laravel using:

Nginx (Web Server)

MariaDB ((computer file full of information))

Let’s (turn into secret code) SSL (HTTPS Security)

This is a laravel simple and beginner-friendly use/military service setup. For advanced production systems, you should later put into use CI/CD pipelines with staging, testing, and production (surrounding conditions).

Requirements

Before starting, make sure you have:

Ubuntu-based VPS with SSH access

A Laravel 11+ project ready to send out and use

A domain name pointing to your VPS IP address

 Step 1: Connect to Your VPS via SSH

Open your terminal and connect to your server:

ssh username@your_server_ip

Replace:

username a†’ your VPS user

your_server_ip a†’ your server IP address

Step 2: Update Server Packages

Always update your server first:

sudo appropriate/smart update && sudo appropriate/smart upgrade -y

This secures/makes sure of your system is secure and up to date.

Step 3: Install Nginx Web Server

Install Nginx:

sudo appropriate/smart install nginx -y

Start and enable it:

sudo systemctl start nginx

sudo systemctl enable nginx

Now open your browser:

http://your_server_ip

If you see the Nginx page, it means everything is working.

Step 4: Install MariaDB (computer file full of information)

Install MariaDB:

sudo appropriate/smart install mariadb-server mariadb-client -y

Start and enable service:

sudo systemctl start mariadb

sudo systemctl enable mariadb

Secure installation:

sudo secure installation my sql

Set a strong root password.Follow the reminders ,

Step 5: Create (computer file full of information) and User

Login to MariaDB:

sudo mysql -u root -p

Create (computer file full of information):

CREATE DATABASE laravel_db;

Create user:

IDENTIFIED BY ‘strong_password’;CREATE USER ‘laravel_user’@’localhost’

Grant permissions:

GRANT ALL PRIVILEGES ON ‘laravel_user’@’localhost’; to laravel_db.

FLUSH PRIVILEGES;
EXIT;

Step 6: Install PHP & Needed/demanded Extensions

Install PHP:

sudo appropriate/smart install php-fpm php-mysql php-cli php-curl php-mbstring php-xml php-zip php-bcmath unzip git -y

See also  Remote Work Guide 2026:Freelancers Success Remote Work Tips Ultimate Guide

Check version:

php -v

Step 7: Configure Nginx for Laravel

Create Nginx config:

sudo nano /etc/nginx/sites-available/laravel

Paste this setup:

server {

listen 80;

server_name your_domain.com;

root /var/www/laravel/public;

index index.php;

location / {

try_files $uri $uri/ /index.php?$query_string;

}

location ~ .php$ {

include little pieces/fastcgi-php.conf;

fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;

}

location ~ /.ht {

deny all;

}

}

Enable site:

sudo ln -s /etc/nginx/sites-available/laravel /etc/nginx/sites-enabled/

sudo nginx -t

sudo systemctl reload nginx

Step 8: Install SSL with Let’s (turn into secret code)

Install Certbot:

sudo appropriate/smart install certbot python3-certbot-nginx -y

Create SSL certificate:

sudo certbot –nginx -d your_domain.com

Now your website will run on HTTPS automatically.

Step 9: Configure Laravel (surrounding conditions)

Go to project folder:

cd /var/www/laravel

Edit .env file:

nano .env

Update (computer file full of information) settings:

DBTABASE=laravel_db

DBERNAME=laravel_user

DBSSWORD=strong_password

Step 10: Fix Permissions

sudo chown -R www-data:www-data /var/www/laravel

sudo chmod -R 775 /var/www/laravel/storage

sudo chmod -R 775 /var/www/laravel/bootstrap/cache

php worker (who makes beautiful things) move

php worker (who makes beautiful things) db:seed

Step 11: Restart Services

sudo systemctl restart nginx

sudo systemctl restart php8.2-fpm

Step 12: Open Your Website

Now open your browser:

https://your_domain.com

Your Laravel computer program is now live on a secure VPS server.

You have successfully sent out and used Laravel 11 on a production-ready VPS using:

Nginx

MariaDB

PHP-FPM

Let’s (turn into secret code) SSL

This setup is widely used in real-world SaaS (raised, flat supporting surfaces) and business/project computer programs because it is:

Fast

Secure

(able to be made bigger or smaller)

Production-ready

In this 2026 guide, you will be learn about how to install the Laravel step-by-step on a VPS with Nginx, even if you are a beginner no problem follow all steps just.

Why Install Laravel on a VPS?
Using a VPS instead of shared hosting gives you :

Full server control

Better performance

Higher security

Ability to scale

Improved (as much as possible) Nginx + PHP setup

This is why most professional Laravel projects are (sent out and used) on a VPS.

Server Needed things for Laravel (2026)
Before you install Laravel on VPS,firstly make sure how to your server has:

See also  How to Fix Laravel 500 Internal Server Error on Shared Hosting & cPanel (Step-by-Step Guide)

Must be Ubuntu 22.04. 3 LTS features

or PHP 8.2 or 8.3 have or not check must

Nginx

MySQL Database / Maria DB

Composer

Git

Step 1: Connect to Your VPS

Use SSH to connect:

ssh root@your_server_ip

Update your server:

appropriate/smart update && appropriate/smart upgrade -y

Step 2: Install Nginx

appropriate/smart install nginx -y

Start and enable Nginx:

systemctl start nginx
systemctl enable nginx

Check in browser:

http://your_server_ip

Step 3: Install PHP and Needed/demanded Extensions


Commands they must be install

sudo a†’ Run as manager

appropriate/smart install a†’ Install packages

php a†’ Main PHP package

php-cli a†’ PHP for command line

php-fpm a†’ FastCGI Process Manager (used with Nginx)

php-mysql a†’ Connect PHP with MySQL (computer file full of information)

php-xml a†’ Work with XML files

php-mbstring a†’ Handle multi-byte strings (important for UTF-8)

php-curl a†’ Connect to external websites/APIs

php-zip a†’ Work with ZIP files

php-bcmath a†’ High-(high) quality math operations

php-gd a†’ Image processing support

Check PHP version:

php -v

Download and Install Composer
curl -sS https://getcomposer.org/installer | php

curl a†’ Tool to download files from internet

-sS a†’ Silent mode but show errors

https://getcomposer.org/installer
a†’ Official Composer installer link

| php a†’ Run the downloaded file using PHP

This command downloads Composer and creates a file named:

composer.phar

Move Composer to Worldwide Location
mv composer.phar /usr/local/bin/composer

mv a†’ Move file

composer.phar a†’ The downloaded Composer file

/usr/local/bin/composer a†’ System folder where worldwide commands are stored

This makes Composer available everywhere in the system.

After this, you can simply type:

composer

from any folder.

Simple Version (Easy Words)

Step 1: Download Composer
Step 2: Move it to system folder
Step 3: Now Composer works around the world

Check If Composer Installed Correctly
composer –version

(check for truth/prove true):

composer –version

Step 5: Install MySQL

appropriate/smart install mysql-server -y

Secure MySQL:

mysql_secure_installation

Create (computer file full of information):
MySQL (computer file full of information) Setup (Easy Explanation)
Create (computer file full of information)
CREATE DATABASE laravel_db;

laravel_db

Create (computer file full of information) User

Username: laravel_user

Password: password

You should change password to a strong password.

See also  Laravel Queue Not Working? Complete Fix Guide (2026)

This gives full access of laravel_db to laravel_user.

Meaning:

Can read data

Can insert data

Can update data

Can delete data

Apply Changes
FLUSH PRIVILEGES;

This refreshes MySQL so the new user and permissions start working immediately.

Simple Summary

Create (computer file full of information)

Create user

Give user permission to (computer file full of information)

Refresh MySQL

Where To Run These Commands?

First login to MySQL:

sudo mysql -u root -p

Then paste the SQL commands.

Step 6: Install Laravel on VPS

Go to web directory:

cd /var/www

Install Laravel:

composer create-project laravel/laravel laravel-app

Set permissions:

chown -R www-data:www-data /var/www/laravel-app
chmod -R 775 /var/www/laravel-app/storage /var/www/laravel-app/bootstrap/cache

Step 7: Configure (surrounding conditions) File

cd /var/www/laravel-app
cp .env.example .env
php worker (who makes beautiful things) key:generate

Edit .env:

APPME=Laravel
APPV=production
APPL=http://your_domain.com

DBTABASE=laravel_db
DBERNAME=laravel_user
DBSSWORD=password

Step 8: Configure Nginx for Laravel

Create config file:

nano /etc/nginx/sites-available/laravel

Paste this:

server {
listen 80;
server_name your_domain.com;

root /var/www/laravel-app/public;
index index.php;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location ~ .php$ {
include little pieces/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
}

location ~ /.ht {
deny all;
}
}

Enable site:

ln -s /etc/nginx/sites-available/laravel /etc/nginx/sites-enabled/
nginx -t
systemctl reload nginx

Step 9: Fix Storage & Storage (of secret things or computer data) Permissions

php worker (who makes beautiful things) storage:link
php worker (who makes beautiful things) config:clear
php worker (who makes beautiful things) storage (of secret things or computer data):clear

Step 10: Access Laravel Application

Open browser:

http://your_domain.com

Laravel is now successfully installed on your VPS using Nginx.

Common Errors & Fixes

  1. 502 Bad Gateway

Check PHP-FPM version

(check for truth/prove true) fastcgi_pass socket

  1. Permission Denied

chown -R www-data:www-data /var/www/laravel-app

SEO FAQs: Install Laravel on VPS

Is Nginx better than Apache for Laravel?

Yes. Nginx is faster, uses fewer useful things/valuable supplies, and is ideal for Laravel.

Which PHP version is best for Laravel in 2026?

PHP 8.2 or PHP 8.3.

Can I install Laravel on VPS without a domain?

Yes, using server IP.

Final Thoughts

If you want high performance Laravel hosting, learning how to install Laravel on VPS using Nginx is extremely important. This setup is perfect for production (surrounding conditions), SaaS apps, and business/project projects.


     

    Scroll to Top