从Puma将本地Web服务器更改回Rails中的WEBrick

问题描述 投票:17回答:3

我正在关注设置Puma并输入此命令的Heroku文档:

bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}

这使得我现在只要运行rails s就在我的开发环境中运行puma。但是,或者Puma导致havok的任何原因。如何切换回使用WEBrick?

试着

bundle exec webrick -p ${PORT:-3000} -e ${RACK_ENV:-development}

但当然,找不到命令:webrick。知道'太容易了......

谢谢!

ruby-on-rails webrick puma
3个回答
31
投票

要使用webrick在开发中运行本地服务器,您只需在运行rails server时指定它:

rails server webrick

如果你将puma移动到Gemfile的生产组,你可以将它恢复为webrick:

group :production do
  gem 'puma'
end

然后捆绑没有生产组:

bundle install --without production

2
投票

根据以下内容:

How to set Rails dev server to webbrick instead of Puma

您想将Gemfile更改为:

group :production do
  gem 'puma'
end

运行bundle install --without production会将WEBrick设置为非生产(开发和测试)服务器,并将Puma设置为生产。


0
投票

从gemfile中删除puma gem并将其捆绑。

并启动该应用程序。您可以在控制台中看到webrick应用服务器启动信息。

默认的应用程序Web服务器是Webrick

© www.soinside.com 2019 - 2024. All rights reserved.