我正在尝试使用Foreman(版本0.31.0)来管理我们应用程序的进程,但我没有太多的运气与nginx (nginx/1.0.10 + Phusion Passenger 3.0.11)。
这是我的Procfile中的相关行:
nginx: sudo /home/ubuntu/nginx/sbin/nginx
当我启动应用程序时,Foreman报告nginx启动然后立即终止:
$ foreman start
21:18:28 nginx.1 | started with pid 27347
21:18:28 nginx.1 | process terminated
21:18:28 system | sending SIGTERM to all processes
然而,nginx实际上正在运行,即使Foreman报告不是这样。
同样,如果我导出到Upstart:
rvmsudo foreman export upstart /etc/init -a my_app -u ubuntu
并运行sudo start my_app
, nginx正常启动。但是sudo stop my_app
并不能阻止nginx。它继续运行。
是否有技巧让nginx与Foreman一起工作?
注意:我在Foreman身上发现了这个问题,我想知道它是否相关。
你想要在前台模式下运行nginx,可以在nginx.conf
中添加以下内容daemon off;
你可以使用-c参数为nginx指定一个自定义nginx.conf