Ruby-on-rails 如何使用独角兽和配置文件在生产模式下启动 rails 服务器?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17409910/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 22:16:18  来源:igfitidea点击:

How to start rails server in production mode using unicorn and config file?

ruby-on-railsunicorn

提问by Sefier Tang

I add Gem 'unicorn'to Gemfile and call rails server unicorn -e production, but I get a load error. Then I add Gem 'unicorn_rails', then call rails server unicorn -e production, but I can't find the socket file. So I am considering if it doesn't use the config/unicorn.rbfile as the configuration? So I call unicorn_rails -c config/unicorn.rb -E production -D, but I get another error text file busy.

我添加Gem 'unicorn'到 Gemfile 并调用rails server unicorn -e production,但出现加载错误。然后我添加Gem 'unicorn_rails',然后调用rails server unicorn -e production,但我找不到套接字文件。所以我在考虑它是否不使用该config/unicorn.rb文件作为配置?所以我打电话unicorn_rails -c config/unicorn.rb -E production -D,但我收到另一个错误text file busy

So now I am stuck in this matter, could you help me? :)

所以现在我被困在这件事上,你能帮我吗?:)

回答by number5

It should be something looks like:

它应该是这样的:

bundle exec unicorn -E production -c config/unicorn.rb

and you should only need unicorngem

你应该只需要unicorngem

回答by Dom Barker

bundle exec unicorn -p $PORT -c ./config/unicorn.rb

bundle exec unicorn -p $PORT -c ./config/unicorn.rb

works for me

对我来说有效

I put it in the Procfile and then use Foremanto start it off by entering

我把它放在 Procfile 中,然后使用Foreman通过输入启动它

foreman start

foreman start

回答by Parthiv

web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb

service unicorn_projectName start

works for me

对我来说有效