ruby-on-rails - Rails + Passenger : Invalid Route name, 已在使用中

标签 ruby-on-rails ruby apache passenger

我正在尝试在 RHEL 6.3 机器上使用 Apache 和 Passenger 托管 Rails 4 应用程序。当 httpd 服务运行时,可以通过服务器上的 IP 地址访问我的应用程序,但当我尝试访问页面时,会出现 Rails“出现错误”页面。通过 rails 服务器托管时,应用程序可以正常运行。我希望有更多托管经验的人可以帮助我并告诉我哪里出错了。

/etc/httpd/conf/httpd.conf 包括:

LoadModule passenger_module /usr/lib/ruby/gems/2.2.0/gems/passenger-5.0.20/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
    PassengerRoot /usr/lib/ruby/gems/2.2.0/gems/passenger-5.0.20
    PassengerDefaultRuby /usr/bin/ruby
</IfModule>

哪个 ruby​​ 返回 /usr/bin/ruby

/etc/httpd/conf.d/server.conf 包括:

<VirtualHost *:80>
# !!! Be sure to point DocumentRoot to 'public'!
  DocumentRoot /var/www/service/public
  RailsEnv production
  <Directory /var/www/service/public
   AllowOverride all
   Options -MultiViews
  </Directory>
</VirtualHost>

其中 service 是我的 Rails 项目所在文件夹的名称。

/etc/httpd/logs/error_log 中的乘客错误是:

App 23360 stdout:
[ 2015-10-05 12:05:43.4683 23295/7fd764072700 age/Cor/App/Implementation.cpp:303 ]: Could not spawn process for application /var/www/service: An error occured while starting up the preloader.
Error ID: aa70e16a
Error details saved to: /tmp/passenger-error-41xm1e.html
Message from application: Invalid route name, already in use: 'base'
You may have defined two routes with the same name using the `:as` option, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created with `resources` as explained here:
http://guides.rubyonrails.org/routing.html#restricting-the-routes-created (ArgumentError)
/usr/lib/ruby/gems/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:538:in `add_route'...

我已经缩减了我的路线,试图找出为什么它认为我有多个名为“base”的路线,因为这是我 route 的所有路线:

Service::Application.routes.draw do

  match 'home' => 'activation#register', :as => :base

end

home 只是一个显示“SUCCESS”的测试链接。

我很困惑 - 我不知道为什么 Passenger 认为我有多个名为 base 的路由,而实际上只有一个。我想知道这些路线是否以某种方式被多次加载。

由于在公司防火墙后面,我无法使用 RVM、yum 或任何其他代码管理器。不幸的是,这是没有商量余地的。

我感谢所有帮助,非常感谢。让我知道是否有人需要我发布更多详细信息。

最佳答案

乘客作者在这里。我想你遇到了 issue #1596行为的细微变化会导致某些应用程序初始化 Rails 两次。计划在下一个版本中进行修复,但现在您可以简单地降级到 5.0.15。

关于ruby-on-rails - Rails + Passenger : Invalid Route name, 已在使用中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32995466/

相关文章:

ruby-on-rails - 安装包时出现 fatal error (安装 libv8 时)

iOS,rails,设计 : How to persist user login (session vs authentication_token)

javascript - Ruby on Rails : Javascript: prototype. js:3483 未捕获类型错误:无法调用 null 的方法 'getElementsByTagName'

ruby-on-rails - 管理员用户允许删除和编辑其他用户

apache - htaccess 重定向带参数并排除一个文件夹

ruby-on-rails - rails - 查找多个数组之间的交集

html - 如何移动搜索栏内的搜索按钮?

RUBY 2.0.0 如何在 irb 中运行一个文件,使其所有方法都是 irb 环境的一部分?

apache - Apache 中的 SSL 证书无效

php - 替换为新日志文件后,访问日志将不会记录