
Keyword: install Laravel on VPS
Framework: Laravel 11+
Web Server: Nginx
Installing Laravel by use a VPS using Nginx is the preferred setup for (the ability to be made bigger or smaller) speed, security etc.
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:
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.
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
- 502 Bad Gateway
Check PHP-FPM version
(check for truth/prove true) fastcgi_pass socket
- 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.