CloudLinux.ro
Web servers

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 pricing

Related tutorials