Laravel Website Installation: Complete VPS Setup Checklist
A complete, ordered checklist for installing a Laravel website on a VPS. Covers PHP setup, Composer, .env configuration, database migrations, storage permissions, web server configuration, SSL, queues, and verification.
Why a Checklist Matters for Laravel VPS Deployment
Laravel is a well-structured framework, but deploying it to a production VPS involves more than just uploading files. A missed step — wrong permissions, uncached configuration, or a missing PHP extension — can silently break your application or expose it to security risks. This checklist walks you through every required step in the correct order.
Pre-Deployment Checklist
Server Requirements
- PHP version compatible with your Laravel version (Laravel 10+ requires PHP 8.1+, Laravel 11+ requires PHP 8.2+)
- Required PHP extensions: BCMath, Ctype, cURL, DOM, Fileinfo, JSON, Mbstring, OpenSSL, PCRE, PDO, Tokenizer, XML
- Composer 2.x installed
- MySQL 5.7+ or MariaDB 10.3+
- Apache or Nginx web server
- Sufficient disk space and RAM for your application load
Step 1: Upload Application Files
- Upload your Laravel project as a zip archive via SCP, SFTP, or your hosting control panel
- Extract to your web root (e.g.,
/var/www/myapp) - Do not place files inside
/var/www/htmldirectly — use a dedicated directory
Step 2: Install PHP Dependencies
cd /var/www/myapp
composer install --no-dev --optimize-autoloaderThe --no-dev flag excludes development-only packages from your production installation. The --optimize-autoloader flag generates an optimized class map for faster autoloading.
Step 3: Create and Configure .env
cp .env.example .env
nano .envEssential .env values to set:
APP_NAME— your application nameAPP_ENV=productionAPP_DEBUG=false— critical for production securityAPP_URL— your full domain with https://DB_CONNECTION=mysqlDB_HOST,DB_PORT,DB_DATABASE,DB_USERNAME,DB_PASSWORD
Step 4: Generate Application Key
php artisan key:generateThis generates a unique encryption key and writes it to your .env as APP_KEY. Never share this key or commit it to version control.
Step 5: Create and Configure the Database
mysql -u root -p
CREATE DATABASE myapp_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'myapp_user'@'localhost' IDENTIFIED BY 'strong_password';
GRANT ALL PRIVILEGES ON myapp_db.* TO 'myapp_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;Step 6: Run Database Migrations
php artisan migrate --forceThe --force flag is required in production mode. If your application has seeders:
php artisan db:seed --forceStep 7: Set Correct File Permissions
sudo chown -R www-data:www-data /var/www/myapp
sudo find /var/www/myapp -type f -exec chmod 644 {} \;
sudo find /var/www/myapp -type d -exec chmod 755 {} \;
sudo chmod -R 775 /var/www/myapp/storage
sudo chmod -R 775 /var/www/myapp/bootstrap/cacheStep 8: Create Public Storage Symlink
php artisan storage:linkThis creates a symlink from public/storage to storage/app/public, making stored files publicly accessible via URL.
Step 9: Optimize for Production
php artisan config:cache
php artisan route:cache
php artisan view:cacheThese commands cache your configuration, routes, and compiled views for significantly faster response times in production.
Step 10: Configure Web Server
For Nginx
Create a server block at /etc/nginx/sites-available/myapp pointing the root to /var/www/myapp/public with a try_files $uri $uri/ /index.php?$query_string directive for PHP-FPM.
For Apache
Set your DocumentRoot to /var/www/myapp/public, enable mod_rewrite, and ensure AllowOverride All is set for the directory. Laravel's built-in .htaccess handles URL rewriting.
Step 11: SSL Certificate Setup
Install a free SSL certificate using Let's Encrypt:
sudo apt install certbot -y
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.comOr for Apache:
sudo certbot --apache -d yourdomain.com -d www.yourdomain.comStep 12: Queue Workers (if required)
If your application uses Laravel queues, create a supervisor configuration or PM2 process for the queue worker:
php artisan queue:work --daemonStep 13: Scheduled Tasks (if required)
Add the Laravel scheduler to your system cron:
* * * * * cd /var/www/myapp && php artisan schedule:run >> /dev/null 2>&1Post-Installation Verification Checklist
- Application loads at your domain without errors
- HTTPS is working and redirects HTTP traffic correctly
- User login and registration function correctly
- File uploads work (storage symlink is correct)
- Emails send correctly (if your app sends emails)
- Background jobs process correctly (if using queues)
APP_DEBUG=falsein production (no debug info visible)- Check
storage/logs/laravel.logfor any silent errors
Common Laravel Installation Errors
Class Not Found
Run composer dump-autoload to regenerate the autoloader classmap.
TokenMismatchException on Forms
Usually a session or storage permissions issue. Check the storage directory permissions.
Redirect Loop
Often caused by incorrect APP_URL in .env or a missing trusted proxy configuration when behind a load balancer or reverse proxy.
500 Internal Server Error
Check storage/logs/laravel.log for the actual error message. Common causes: missing .env values, failed migrations, PHP extension not installed.
Professional Laravel Installation Service
Prefer to have your Laravel application installed by professionals? MQ Tech Guru offers a Laravel Website Installation Service — we handle the complete setup on your VPS, including database, .env, migrations, web server, SSL, and domain configuration.
Back to blog