VPS for Laravel: PHP, queues, Redis and sizing memory
A Laravel application rarely stops at web requests: alongside it run queue workers, the scheduler, Redis for cache and sessions, a database and sometimes the Reverb WebSocket server. All of this lives on one VPS, and the server has to be chosen for the whole set of processes, not for "a PHP site". The table above shows plans with 2 cores, 2 GB of memory and NVMe or more, from hosts with an API, so that servers can be created from CI or through Laravel Forge.
PHP version and environment
Laravel 13 requires PHP 8.3 or newer, Laravel 12 needs 8.2 or newer. Choose a system where the version you need is available in official or trusted repositories: on Ubuntu LTS and Debian, recent PHP branches are usually installed from third-party repositories run by the package maintainers, and on AlmaLinux and Rocky Linux from Remi. The framework needs the mbstring, xml, curl, pdo, openssl, tokenizer and fileinfo extensions; for Redis queues add phpredis.
Configure OPcache separately; without it every request parses hundreds of framework and package files all over again:
opcache.memory_consumption: 128–256 MB, with headroom for vendor;opcache.max_accelerated_files: 20,000 or more;opcache.validate_timestamps=0in production: faster, but after every deploy you have to reload PHP-FPM, otherwise the server keeps serving the old code.
Run php artisan optimize on deploy: it caches configuration, routes, events and views. Once configuration is cached, the env() function returns null outside config files, a common cause of a "suddenly" broken production.
Queues, Horizon and Redis
queue:work workers are long-lived processes; they are run under supervisor or systemd so that they come back after a crash or reboot. Laravel Horizon manages workers itself and shows a dashboard with metrics, but it works only with Redis. After every deploy the workers must be restarted (php artisan horizon:terminate or queue:restart, and in newer versions the combined php artisan reload), otherwise they run jobs with the old code. Don't forget the scheduler either: one line in cron calling schedule:run every minute.
With Laravel, Redis usually holds the cache, sessions and the queue at the same time. Split them into different Redis databases, or at least different prefixes, so that cache:clear doesn't wipe jobs from the queue. If there is a lot of cached data or Redis serves several projects, move it to a separate machine; choosing a server for it is covered on the VPS for Redis page.
How much memory and how many cores to take
Count by process:
- a PHP-FPM process with Laravel: 40–80 MB, and 5–10 processes are enough for a small site;
- a queue worker: 50–150 MB depending on the jobs, and Horizon keeps several workers per queue by default;
- MySQL or PostgreSQL: 300–500 MB or more, more under load; database tuning is on the VPS for MySQL page;
- Redis: tens of megabytes plus the size of the data.
So 2 GB is enough for an application with moderate traffic and a couple of workers, while 4 GB and 2–4 cores suit a project with busy queues, mailings and file generation. Heavy jobs such as image processing and importing large files are CPU-bound, so limit the number of concurrent workers for them so they don't take cores away from web requests. If you use Octane on FrankenPHP, Swoole or RoadRunner, the application stays in memory between requests: responses are faster, but each worker permanently holds its own copy of the framework.
Before launch, check the basics that are most often forgotten: APP_DEBUG=false in production, otherwise the error page will show visitors your environment variables; write permissions for the PHP-FPM user only on storage and bootstrap/cache; log rotation in storage/logs or the daily driver. The built-in /up route is handy to give to an external uptime monitor.
Zero-downtime deployment
The classic setup is release directories and a current symlink: the new release is built next to the live one, composer install --no-dev --optimize-autoloader and migrations are run, then the symlink is switched, PHP-FPM is reloaded and workers are restarted. The storage directory and the .env file are shared by all releases. It's better to build a Vite front end in CI and upload the ready files: a build on a server with 2 GB of memory can eat all the memory and take down the running application. For a separate build server look at VPS for CI/CD runners, and if you don't want to write Nginx configs by hand, there's the free CloudPanel with a ready Laravel site template.