一些导游(example)推荐给启动一个的Web服务器`轨服务器puma`与`puma`
bundle exec rails server puma
但我总是刚开始的服务器puma
直接
bundle exec puma
当通过rails server
启动puma(或任何其他服务器)时会发生什么特殊情况?
一些导游(example)推荐给启动一个的Web服务器`轨服务器puma`与`puma`
bundle exec rails server puma
但我总是刚开始的服务器puma
直接
bundle exec puma
当通过rails server
启动puma(或任何其他服务器)时会发生什么特殊情况?
当您使用rails s <server>
时,服务器从Rails命令启动,并且知道Rails环境。
这使得例如可以使用由rails server command
提供的任何特征和标志。
rails s --help
Usage: rails server [mongrel, thin, etc] [options]
-p, --port=port Runs Rails on the specified port.
Default: 3000
-b, --binding=ip Binds Rails to the specified ip.
Default: 0.0.0.0
-c, --config=file Use custom rackup configuration file
-d, --daemon Make server run as a Daemon.
-u, --debugger Enable ruby-debugging for the server.
-e, --environment=name Specifies the environment to run this server under (test/development/production).
Default: development
-P, --pid=pid Specifies the PID file.
Default: tmp/pids/server.pid
-h, --help Show this help message.
例如,您可以调试器附着在经过--debugger
会话或守护进程的服务器。
第二个好处是,您可以版本Puma
实例,因为您必须列出Gemfile
中的宝石。如果你像bundle exec
那样开始它,这已经是事实。相反,当您只需运行$ puma
(或$ bundle exec puma
)时,您不会通过Rails系统。 Puma
将试图找到一个机架的启动文件,将使用它(它的工作原理,因为Rails提供在应用程序根config.ru
脚本。
一般来说,有是,如果你并不需要传递给特定的选项没有真正的区别服务器。我喜欢彪马,我倾向于在某些项目中使用它,即使在生产我们用麒麟,从而运行$ puma
作为一个独立的命令很简单,因为我并不需要把它添加到Gemfile
。
然而,如果我的整个堆栈使用Puma
,我可能会用$ rails s puma
。这也是command suggested in the documentation。
当运行rails s puma配置文件,你有没有得到加载......这是缺点。这是一个使用配置文件(config/puma.rb)启动服务器的快捷别名。 JUST COPY PASTE echo'alias start_puma =“bundle exec puma -p 3000 -S〜/ puma -C config/puma.rb”'>>〜/ .bash_profile && source〜/ .bash_profile THEN USE start_puma – blnc