Step‑by‑Step Guide to Configure Supervisor for Laravel
1. Install Supervisor
On a typical Ubuntu server, you install Supervisor with:
sudo apt update
sudo apt install supervisor
This installs the supervisord daemon and tools like supervisorctl to manage service processes. Laravel
2. Create Supervisor Configuration for Laravel
Create a config file in Supervisor’s directory:
sudo nano /etc/supervisor/conf.d/laravel-worker.conf
Add the following:
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /path/to/your/laravel-app/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/log/laravel-worker.log
➡️ Update:
- /path/to/your/laravel-app/ → path to your Laravel project
- user → the Linux user that should run the process (e.g.,
www-data,forge, etc.) - stdout_logfile → where you want logs saved Laravel
3. Reload Supervisor and Start the Worker
Once the config is saved, tell Supervisor to load it:
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-worker:*
You can check the status with:
sudo supervisorctl status
This ensures your Laravel queue worker is running and monitored by Supervisor. Laravel
4. (Optional) Using Supervisor with Docker
If you’re running Laravel inside Docker, you can include Supervisor config files in your project and mount them into your container. This keeps everything version‑controlled and reproducible across environments:
Example in docker-compose.yml:
services:
web:
image: your‑laravel‑image
volumes:
- .:/var/www/html
- ./.docker/web/supervisor.conf:/etc/supervisor/conf.d/supervisor.conf
This way, your Docker container always uses the correct Supervisor setup.