How to deploy a Laravel app to production
Updated 7/20/2026
Laravel has a few production-specific steps. Here is the correct setup on a VPS with Nginx and PHP-FPM.
1. Bring the code and dependencies
cd /var/www/app
composer install --no-dev --optimize-autoloader
cp .env.example .env
php artisan key:generate
2. Permissions
chown -R www-data:www-data storage bootstrap/cache
3. Nginx server block
The public root is the public directory:
server {
listen 80;
server_name example.com;
root /var/www/app/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
}
4. Production optimizations
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan migrate --force
5. The queue worker
If you use queues, run a persistent worker with Supervisor or systemd:
php artisan queue:work --daemon
Do not forget a backup for your Laravel app.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
Web servers
How to optimize Nginx performance: gzip, cache and HTTP/2
Make your site faster with gzip compression, static file caching and HTTP/2, a few lines of config.
Updated 7/20/2026Web serversHow to install phpMyAdmin to manage MySQL from the browser
Manage your MySQL databases from a web interface with phpMyAdmin, installed and secured correctly.
Updated 7/20/2026Web serversHow to host a static site or a React/Vue app
Publish a static site or a React/Vue build on Nginx, with correct routing for single-page apps.
Updated 7/20/2026