工头不与NGINX合作

我正在尝试使用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

但是,即使Foreman另有报告,nginx实际上仍在运行.

同样,如果我导出到Upstart:

rvmsudo foreman export upstart /etc/init -a my_app -u ubuntu

并运行sudo start my_app,nginx正常启动.但是sudo停止my_app不会阻止nginx.它继续运行.

让nginx与Foreman合作是否有诀窍?

注意:我发现了this issue with Foreman,我想知道它是否相关.

最佳答案
您需要通过在nginx.conf中添加以下内容来在前台模式下运行nginx

daemon off;

您可以使用-c参数为nginx指定自定义nginx.conf

相关文章

文章浏览阅读3.7k次,点赞2次,收藏5次。Nginx学习笔记一、N...
文章浏览阅读1.7w次,点赞14次,收藏61次。我们在使用容器的...
文章浏览阅读1.4k次。当用户在访问网站的过程中遇到404错误时...
文章浏览阅读2.7k次。docker 和 docker-compose 部署 nginx+...
文章浏览阅读1.3k次。5:再次启动nginx,可以正常启动,可以...
文章浏览阅读3.1w次,点赞105次,收藏182次。高性能:Nginx ...