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

工头不能启动Nginx,但我可以手动启动它 为什么?

我目前正在运行福尔曼 (Ubuntu),一旦我得到它的工作将切换到使用暴发户。

我的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不:

来自领class的“No Processes Defined”检查一个简单的node.js procfile

在Ubuntu上重新生成Tomcat的Upstart脚本

Node.js:Foreman + Windows上的nodemon行为

在窗户上安装Heroku toolbelt的工头无法find

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

那么为什么Nginx不是从Foreman开始呢?

这是您的procfile中的一个问题。

Nginx命令不能在foreman使用sudo ,因为它always ask for a password ,然后就会失败。 这就是为什么你不启动Nginx ,日志是空的。

如果你真的需要在一个proc文件中使用sudo,你可以使用像这样的东西:

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

我真的不建议。 其他选择是打电话给sudo foreman start

要了解更多的信息在github上查看这个问题 ,这正是你想要解决的。

保持我张贴,如果它适合你。

您应该可以添加sudo访问权限,无需您的本地用户密码,以允许管理此服务。 这可能是一个很大的安全漏洞,但是如果您将可以运行的命令列入白名单,则可以显着降低风险。 我建议为services命令添加no-password sudoers条目以及其他你想要的脚本:

的/ etc / sudoers中:

your_user_name ALL = (ALL) nopASSWD: /usr/sbin/service

一个选择,如果你不适应这个将是直接运行Nginx,而不是通过服务管理器:

Nginx: /usr/sbin/Nginx -c /path/to/Nginx.conf

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

相关推荐