Deploy a Laravel application
Updated 27 Nov 2026 laravel php
Permissions, environment, caches, queue workers and the scheduler.
Install Nginx and PHP-FPM, Composer and your database first. Check the PHP version your Laravel release needs.
Files
cd /var/www/app
composer install --no-dev --optimize-autoloader
cp .env.example .env && php artisan key:generate
sudo chown -R www-data:www-data storage bootstrap/cache
sudo chown root:www-data .env && sudo chmod 640 .env
Set APP_ENV=production and APP_DEBUG=false. Back up APP_KEY.
Release steps
php artisan migrate --force
php artisan config:cache && php artisan route:cache && php artisan view:cache
php artisan queue:restart
Web root
Point Nginx at the public folder only.
Scheduler
In /etc/cron.d/app:
* * * * * www-data cd /var/www/app && php artisan schedule:run >> /dev/null 2>&1
Queue worker
/etc/systemd/system/app-queue.service:
[Service]
User=www-data
WorkingDirectory=/var/www/app
ExecStart=/usr/bin/php artisan queue:work --tries=3 --max-time=3600
Restart=always
[Install]
WantedBy=multi-user.target