工头不能与NGINX一起使用 [英] Foreman not working with NGINX
问题描述
我正在尝试使用工头(版本0.31.0)来管理我们应用程序的流程,但是我没有太多用Nginx运气好(nginx/1.0.10 + Phusion Passenger 3.0.11).
I'm trying to use Foreman (version 0.31.0) to manage our application's processes but I'm not having much luck with nginx (nginx/1.0.10 + Phusion Passenger 3.0.11).
这是我的Procfile中的相关行:
Here's the relevant line from my Procfile:
nginx: sudo /home/ubuntu/nginx/sbin/nginx
当我启动应用程序时,Foreman报告nginx已启动,然后立即终止:
When I start the app, Foreman reports that nginx is started and then immediately terminated:
$ 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另有报告也是如此.
However, nginx is actually running, even though Foreman reports otherwise.
类似地,如果我导出到Upstart:
Similarly, if I export to Upstart:
rvmsudo foreman export upstart /etc/init -a my_app -u ubuntu
并运行sudo start my_app
,nginx正常启动.但是sudo stop my_app
不会停止nginx .它继续运行.
and run sudo start my_app
, nginx starts properly. But sudo stop my_app
does not stop nginx. It continues running.
让nginx与Foreman配合使用是否有技巧?
Is there a trick to getting nginx to work with Foreman?
注意:我发现与工头有关的问题,我想知道是否与此有关. /em>
Note: I found this issue with Foreman and I'm wondering if it's related.
推荐答案
您需要通过将以下内容添加到nginx.conf中来在前台模式下运行nginx
You'll want to run nginx in foreground mode by adding the following to your nginx.conf
daemon off;
您可以使用-c参数将自定义nginx.conf指定为nginx
You can specify a custom nginx.conf to nginx with the -c argument
这篇关于工头不能与NGINX一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!