The error message you're encountering is quite explicit - your Supervisor configuration file is missing the mandatory [supervisord]
section. While you've correctly defined a [program]
section, Supervisor requires its own configuration section to operate properly.
Here's what a basic valid supervisord.conf
should look like:
[supervisord]
nodaemon=false
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:myapp]
command=/usr/local/bin/run_queue.sh
autostart=true
autorestart=true
stderr_logfile=/var/log/laraqueue.err.log
stdout_logfile=/var/log/laraqueue.out.log
The [supervisord]
section controls the main Supervisor process. Essential parameters include:
[supervisord]
; Run in the foreground (useful for debugging)
nodaemon=false
; Main process log file
logfile=/var/log/supervisor/supervisord.log
; PID file location
pidfile=/var/run/supervisord.pid
; Log level (debug, info, warn, error, critical)
loglevel=info
; User to run as (recommended)
user=root
On CentOS systems, you might also want to consider:
[unix_http_server]
file=/var/run/supervisor.sock
chmod=0700
chown=nobody:nogroup
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock
After updating your configuration, always validate it with:
supervisord -c /etc/supervisord.conf --check
Or for more detailed checking:
supervisord -c /etc/supervisord.conf --nodaemon
Here's a more complete configuration example suitable for production:
[unix_http_server]
file=/var/run/supervisor.sock
chmod=0700
chown=nobody:nogroup
[supervisord]
logfile=/var/log/supervisor/supervisord.log
logfile_maxbytes=50MB
logfile_backups=10
loglevel=info
pidfile=/var/run/supervisord.pid
nodaemon=false
minfds=1024
minprocs=200
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock
[program:worker]
command=/usr/bin/php /path/to/worker.php
process_name=%(program_name)s_%(process_num)02d
numprocs=4
autostart=true
autorestart=true
user=www-data
stdout_logfile=/var/log/worker.log
stderr_logfile=/var/log/worker.err.log
If you're still facing issues, try these debugging steps:
# Check for syntax errors
supervisord --version
supervisord --help
# Run in foreground with debug output
supervisord -c /etc/supervisord.conf -n -d
# Verify file permissions
ls -la /etc/supervisord.conf
When setting up Supervisor on CentOS 6.5, I encountered this persistent error despite having what looked like a valid configuration file. The key issue is that Supervisor requires a mandatory [supervisord]
section in its configuration file, which acts as the root configuration block.
Supervisor's configuration file follows a strict INI format with specific required sections:
[supervisord]
[unix_http_server]
[supervisorctl]
[include]
[program:x]
The minimal viable configuration must include at least the [supervisord]
section before any program definitions.
Here's how your /etc/supervisord.conf
should be structured:
[supervisord]
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
nodaemon=false
[program:myapp]
command=/usr/local/bin/run_queue.sh
autostart=true
autorestart=true
stderr_logfile=/var/log/laraqueue.err.log
stdout_logfile=/var/log/laraqueue.out.log
When setting up Supervisor:
- Always include the
[supervisord]
section first - Specify at least logfile and pidfile locations
- Consider adding these recommended parameters:
[supervisord]
logfile=/var/log/supervisor/supervisord.log
logfile_maxbytes=50MB
logfile_backups=10
loglevel=info
pidfile=/var/run/supervisord.pid
nodaemon=false
minfds=1024
minprocs=200
After updating your config file, validate it with:
supervisord -c /etc/supervisord.conf --check
This will catch syntax errors before attempting to run the service.
1. Missing required sections
2. Incorrect file permissions (should be readable by supervisord user)
3. Using relative paths in configuration
4. Forgetting to escape special characters in commands
For production systems, consider this more complete setup:
[unix_http_server]
file=/var/run/supervisor.sock
chmod=0700
[supervisord]
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
childlogdir=/var/log/supervisor
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock
[program:worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
user=www-data
numprocs=8
redirect_stderr=true
stdout_logfile=/var/log/worker.log
This configuration includes socket communication, multiple worker processes, and proper logging setup.