supervisord 管理nginx app

在使用supervisord管理nginx的时候,发现nginx提示端口占用后异常退出,

2019-03-15 02:36:37,587 INFO RPC interface 'supervisor' initialized
2019-03-15 02:36:37,587 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2019-03-15 02:36:37,588 INFO supervisord started with pid 9662
2019-03-15 02:36:38,591 INFO spawned: 'nginx' with pid 9664
2019-03-15 02:36:38,595 INFO spawned: 'app-gunicorn' with pid 9665
2019-03-15 02:36:38,616 INFO exited: nginx (exit status 0; not expected)
2019-03-15 02:36:39,610 INFO success: app-gunicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-03-15 02:36:39,628 INFO spawned: 'nginx' with pid 9686
nginx: [emerg] bind() to 0.0.0.0:10087 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:10087 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:10087 failed (98: Address in use)
2019-03-15 02:36:40,652 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
nginx: [emerg] bind() to 0.0.0.0:10087 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:10087 failed (98: Address in use)

手动执行nginx可以正常启动,查询了一番,找到了如下,不能用daemon的方式启动nginx,所以修改nginx配置,添加daemon off; 后恢复正常

Supervisord expects nginx to not fork but remain in foreground. Set daemon to off in the nginx configuration file