Nginx with Supervisor keep changing status b/w Running and Starting

mulkave picture mulkave · Apr 22, 2014 · Viewed 16.8k times · Source

Here's a preview of the status running supervisorctl status every 2 seconds:

[root@docker] ~ # supervisorctl status
nginx                            RUNNING    pid 2090, uptime 0:00:02
[root@docker] ~ # supervisorctl status
nginx                            STARTING   
[root@docker] redis-2.8.9 # supervisorctl status
nginx                            RUNNING    pid 2110, uptime 0:00:01

Is this a normal thing for nginx to respawn every few seconds ? Knowing that nginx is setup to be run in the background with this setup:

[program:nginx]
command=/usr/sbin/nginx
stdout_events_enabled=true
stderr_events_enabled=true

Answer

rafaponieman picture rafaponieman · Sep 9, 2014

Its been a long time, but it might help someone else... set daemon off in your nginx config. Supervisord requires processes not to run as daemons.

You can also set it directly for the supervisor command:

command=/usr/sbin/nginx -g "daemon off;"