KVM VPS from Rs 149/mo. Mumbai, Noida and Jaipur nodes.

24×7 infrastructure operations Sales +91 98297 14343
vpswala.in
VPSWala 3 min read

Laravel VPS Deployment Guide: PHP-FPM, Nginx, Redis and Queue Workers

A production Laravel deployment on a VPS, step by step, following Laravel's own deployment guide.

A production Laravel deployment on a VPS needs Nginx in front of PHP-FPM, the framework's optimisation commands run on every deploy, Redis for cache, sessions and queues, queue workers kept alive by a process supervisor, and the scheduler run by cron. Laravel's deployment documentation covers the framework side. This guide adds the server side.

Prerequisites

  • A KVM VPS with root access. VPS 4 (2 vCPU, 4 GB) suits a small app. VPS 8 (4 vCPU, 8 GB, ₹1,438) is the usual production start.
  • A supported PHP version with the extensions Laravel requires.
  • A domain pointing at the server.

Step 1: Nginx and PHP-FPM

server {
  listen 80;
  server_name app.example.com;
  root /var/www/app/public;
  index index.php;
  location / { try_files $uri $uri/ /index.php?$query_string; }
  location ~ \.php$ {
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    fastcgi_pass unix:/run/php/php-fpm.sock;
  }
  location ~ /\.(?!well-known).* { deny all; }
}

Point the web root at public, never at the project root. Add TLS once the site answers on port 80.

Step 2: size PHP-FPM

The PHP-FPM configuration manual explains the process manager settings. With pm = dynamic, set pm.max_children from memory: measure a worker's typical memory under load, then divide the memory you can spare by that figure. Too many children cause swapping. Too few cause requests to queue.

Step 3: deploy commands

composer install --no-dev --optimize-autoloader
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan migrate --force

Laravel's deployment guide recommends caching configuration, routes and views in production. Set APP_ENV=production and APP_DEBUG=false.

Step 4: Redis, queues and the scheduler

  • Use Redis for cache, sessions and the queue connection.
  • Run workers with php artisan queue:work under Supervisor or systemd so they restart on failure, and restart them on every deploy with php artisan queue:restart.
  • For Redis queues with many jobs, Laravel Horizon adds a dashboard and worker balancing.
  • Add one cron entry: * * * * * php /var/www/app/artisan schedule:run.

Step 5: verify

  1. Load the site with debug off and confirm errors are logged, not shown.
  2. Dispatch a test job and confirm a worker processes it.
  3. Reboot and confirm workers and the scheduler return on their own.

Sizing

PlanvCPUMemoryRAID NVMeTransferMonthly
VPS 212 GB20 GB100 GB₹298
VPS 424 GB40 GB200 GB₹596
VPS 848 GB80 GB400 GB₹1,438
VPS 16616 GB160 GB800 GB₹2,399
VPS 321232 GB320 GB1,600 GB₹4,799

Monthly INR, excluding GST. All ten sizes, from 1 GB (₹149) to 128 GB (₹19,099), are on the VPSWala cloud VPS plans page. Every plan is KVM with RAID NVMe storage and full root access.

PHP request handling depends heavily on single-thread speed, so busy Laravel apps are a good candidate for the 9950X range, starting with 9950X VPS 16 at ₹2,399 per month.

Responsibilities

VPSWala plans are unmanaged unless you agree otherwise in writing: the host platform, network and provisioning are VPSWala's job, and everything inside the VM is yours. Per the terms of service, off-server backups, control-panel licences, Windows licensing, managed administration and extra IPv4 addresses are quoted separately, and any availability commitment applies only where it is written into your quotation or agreement.

Zero-downtime deploys

Deploy each release into its own directory, run Composer and the cache commands there, then switch a current symlink and reload PHP-FPM. If the new release fails, point the symlink back. Tools such as Deployer or Envoyer automate this pattern, but it is simple enough to script yourself.

Security checklist

  • Keep the .env file outside the web root and readable only by the app user.
  • Run PHP-FPM as a dedicated user, not as root.
  • Keep storage and cache directories writable by the app user only.
  • Restrict SSH to key authentication and firewall everything except SSH, HTTP and HTTPS.

Keep logs in storage/logs rotated daily so a noisy error never fills the disk.

Frequently asked questions

Should MySQL run on the same VPS?

For small and medium apps, yes. Separate it once the database needs its own memory or you want independent scaling.

How many queue workers should I run?

Start with one or two per queue and watch how long jobs wait. Add workers when the wait time grows, and watch memory as you do.

Octane or PHP-FPM?

PHP-FPM is the simple, well-understood default. Laravel Octane can raise throughput but changes how state behaves between requests. Adopt it deliberately.


Sources

Written by Aniket Joshi

Not sure which size?

Send the stack, get a size.

Tell us the operating system, application stack, current traffic, database size and where it hurts today. You get a sizing recommendation, the matching plan and a price.

Related

More on this.

Get sizing help See VPS plans