微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby-on-rails – Foreman无法启动Nginx,但我可以手动启动它.为什么?

我目前在登台(Ubuntu)上运行Foreman,一旦我开始工作将切换到使用upstart.

我的procfile.staging看起来像这样:

Nginx: sudo service Nginx start
unicorn: bundle exec unicorn -c ./config/unicorn.rb
redis: bundle exec redis-server
sidekiq: bundle exec sidekiq -v -C ./config/sidekiq.yml

我可以使用以下命令成功启动Nginx

$sudo service Nginx start

但是,当我运行$foreman start,而其他三个进程成功启动时,Nginx不会:

11:15:46 Nginx.1   | started with pid 15966
11:15:46 unicorn.1 | started with pid 15968
11:15:46 redis.1   | started with pid 15971
11:15:46 sidekiq.1 | started with pid 15974
11:15:46 Nginx.1   | Starting Nginx: Nginx.
11:15:46 Nginx.1   | exited with code 0
11:15:46 system    | sending SIGTERM to all processes
SIGTERM received
11:15:46 unicorn.1 | terminated by SIGTERM
11:15:46 redis.1   | terminated by SIGTERM
11:15:46 sidekiq.1 | terminated by SIGTERM

那么为什么在Foreman开始时Nginx不会出现呢?

最佳答案
这是您的procfile中的问题.

Nginx命令不能在foreman中使用sudo,因为它总是要求输入密码然后它将失败.这就是你没有启动Nginx并且日志为空的原因.

如果你真的需要在procfile中使用sudo,你可以使用这样的东西:

sudo_app: echo "sudo_password" | sudo -S app_command
Nginx: echo "sudo_password" | sudo -S service Nginx start

我真的不推荐.其他选择是打电话给sudo工头开始

有关更多信息,请查看此issue on github,这正是您想要解决的问题.

如果它适合你,请让我发布.

原文地址:https://www.jb51.cc/nginx/434572.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐