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

。_饼干妹妹 提交于 2019-11-29 16:43:34

问题


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.rb file as the configuration? So I call unicorn_rails -c config/unicorn.rb -E production -D, but I get another error text file busy.

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


回答1:


It should be something looks like:

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

and you should only need unicorn gem




回答2:


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

foreman start




回答3:


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

service unicorn_projectName start

works for me



来源:https://stackoverflow.com/questions/17409910/how-to-start-rails-server-in-production-mode-using-unicorn-and-config-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!