Operations 4 min read

How to Install and Configure Supervisor for Laravel Workers on Linux

This guide explains how to install Supervisor via pip or yum, configure supervisord.conf and a Laravel worker configuration file, handle common errors, set permissions, and start and manage Laravel queue workers using supervisorctl on a Linux system.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
How to Install and Configure Supervisor for Laravel Workers on Linux

Supervisor is a Python‑based process management tool that can be installed on most Linux distributions. It allows you to keep background services such as Laravel queue workers running reliably.

Installation methods

1. pip installation (or easy_install):

yum install python-setuptools
easy_install pip
pip install supervisor  # or easy_install supervisor
mkdir /etc/supervisor
echo_supervisord_conf > /etc/supervisor/supervisord.conf
mkdir -p /etc/supervisor/conf.d

2. yum installation (recommended) :

yum install supervisor
mkdir /etc/supervisor
echo_supervisord_conf > /etc/supervisor/supervisord.conf
mkdir -p /etc/supervisor/conf.d

Modify the main configuration

vim /etc/supervisor/supervisord.conf
# Add or uncomment the include section
[include]
files = /etc/supervisor/conf.d/*.conf

Create a Laravel worker configuration file

vim /etc/supervisor/conf.d/laravel-worker.conf

Insert the following content (replace paths with your own):

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /www/your_path/artisan queue:work redis --sleep=3 --tries=3
autostart=true
autorestart=true
user=root
numprocs=1
redirect_stderr=true
stdout_logfile=/www/your_path/storage/logs/workers.log

Save and exit the file (e.g., :wq ).

Set directory permissions

chmod -R +x /etc/supervisor/conf.d

Start supervisord

supervisord -c /etc/supervisor/supervisord.conf

If you encounter an error that another program is already listening on a required port, shut it down first:

supervisorctl shutdown

For socket‑related errors, you may need to recreate the socket file and adjust its permissions:

sudo touch /var/run/supervisor.sock
sudo chmod 777 /var/run/supervisor.sock
sudo supervisorctl -c /etc/supervisor/supervisord.conf

Restart supervisord to apply changes:

supervisord -c /etc/supervisor/supervisord.conf

Verify that the daemon is running:

ps -ef | grep 'supervisord'

Start the Laravel worker

sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-worker:*

After the worker starts, you can manually test the queue processing:

php /www/your_path/artisan queue:start
php /www/your_path/artisan queue:work redis --sleep=3 --tries=3

These commands run the Redis and database queue workers respectively.

process managementlinuxLaravelSupervisorQueue Workers
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.