简体   繁体   English

如何使用unicorn和配置文件在生产模式下启动rails服务器?

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

I add Gem 'unicorn' to Gemfile and call rails server unicorn -e production , but I get a load error. 我将Gem'unicorn Gem 'unicorn'添加到Gemfile并调用rails server unicorn -e production ,但是我收到了一个加载错误。 Then I add Gem 'unicorn_rails' , then call rails server unicorn -e production , but I can't find the socket file. 然后我添加Gem 'unicorn_rails' ,然后调用rails server unicorn -e production ,但是我找不到套接字文件。 So I am considering if it doesn't use the config/unicorn.rb file as the configuration? 所以我在考虑是否不使用config/unicorn.rb文件作为配置? So I call unicorn_rails -c config/unicorn.rb -E production -D , but I get another error text file busy . 所以我调用unicorn_rails -c config/unicorn.rb -E production -D ,但我得到另一个错误text file busy

So now I am stuck in this matter, could you help me? 所以现在我被困在这件事上,你能帮助我吗? :) :)

It should be something looks like: 它应该是这样的东西:

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

and you should only need unicorn gem 你应该只需要unicorn宝石

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

works for me 适合我

I put it in the Procfile and then use Foreman to start it off by entering 我把它放在Procfile中,然后使用Foreman通过输入启动它

foreman start

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

service unicorn_projectName start

works for me 适合我

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM