Ruby on Rails 4的Procfile里,为何Unicorn没启动,反被Webrick取代了?

2026-04-11 16:121阅读0评论SEO教程
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计247个文字,预计阅读时间需要1分钟。

Ruby on Rails 4的Procfile里,为何Unicorn没启动,反被Webrick取代了?

我在使用Rails 4.0.1,并希望以unicorn作为我的web服务器运行。然而,当我执行`rails s`时,却使用了Webrick(尽管我在Gemfile中包含了unicorn gem)。这是我的Procfile内容:worker: bundle exec rake jobs:work

我正在使用Rails 4.0.1并且我想将unicorn作为我的web服务器运行,但是当我执行rails s时,使用了Webrick(unicorn gem在我的Gemfile中,所以它不可能).

Ruby on Rails 4的Procfile里,为何Unicorn没启动,反被Webrick取代了?

这是我的Procfile:

worker: bundle exec rake jobs:work web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb

这是unicorn.rb文件:

worker_processes 2 timeout 30 preload_app true before_fork do |server, worker| Signal.trap 'TERM' do puts 'Unicorn master intercepting TERM and sending myself QUIT instead' Process.kill 'QUIT', Process.pid end defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! end after_fork do |server, worker| Signal.trap 'TERM' do puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT' end defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection end

到底是怎么回事?谢谢!

rails服务器不使用您的Procfile;那是 foreman.用工头开始你的申请:

bundle exec foreman start

如果您希望rails服务器也使用Unicorn,您可以包含unicorn-rails gem.

本文共计247个文字,预计阅读时间需要1分钟。

Ruby on Rails 4的Procfile里,为何Unicorn没启动,反被Webrick取代了?

我在使用Rails 4.0.1,并希望以unicorn作为我的web服务器运行。然而,当我执行`rails s`时,却使用了Webrick(尽管我在Gemfile中包含了unicorn gem)。这是我的Procfile内容:worker: bundle exec rake jobs:work

我正在使用Rails 4.0.1并且我想将unicorn作为我的web服务器运行,但是当我执行rails s时,使用了Webrick(unicorn gem在我的Gemfile中,所以它不可能).

Ruby on Rails 4的Procfile里,为何Unicorn没启动,反被Webrick取代了?

这是我的Procfile:

worker: bundle exec rake jobs:work web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb

这是unicorn.rb文件:

worker_processes 2 timeout 30 preload_app true before_fork do |server, worker| Signal.trap 'TERM' do puts 'Unicorn master intercepting TERM and sending myself QUIT instead' Process.kill 'QUIT', Process.pid end defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! end after_fork do |server, worker| Signal.trap 'TERM' do puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT' end defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection end

到底是怎么回事?谢谢!

rails服务器不使用您的Procfile;那是 foreman.用工头开始你的申请:

bundle exec foreman start

如果您希望rails服务器也使用Unicorn,您可以包含unicorn-rails gem.