简体   繁体   中英

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. 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? :)

It should be something looks like:

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

and you should only need unicorn gem

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

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

service unicorn_projectName start

works for me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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