Passenger 在除根 url 之外的所有 url 上开始

Passenger starting on all urls except the root url

我正在尝试使用 apache (2.4.17)、rvm 和 passenger (4.0.59) 将 rails 4.1.0 应用程序部署到我的生产环境。

问题是,当我转到虚拟主机的 url (www.myapp.com) 时,我一直在获取 public 目录的 apache 目录列表。但是:当我导航到 rails-app 内的路线时,例如; www.myapp.com/pages/1 passenger 启动应用程序,一切正常。

这是我的 passenger.conf:

# /etc/apache2/conf-enabled/passenger.conf
LoadModule passenger_module /home/sander/.rvm/gems/ruby-2.1.0-preview2/gems/passenger-4.0.59/buildout/apache2/mod_passenger.so
    <IfModule mod_passenger.c>
       PassengerRoot /home/sander/.rvm/gems/ruby-2.1.0-preview2/gems/passenger-4.0.59
       PassengerDefaultRuby /home/sander/.rvm/gems/ruby-2.1.0-preview2/wrappers/ruby
     </IfModule>

我检查了 apache 模块是否已加载:

>> apache2ctl -M
...
passenger_module (shared)

虚拟主机配置:

<VirtualHost my-ip:80>
  ServerName www.myapp.com
  ServerAlias myapp.com

  DocumentRoot /srv/www/rails/myapp/current/public
  PassengerAppRoot /srv/www/rails/myapp/current
  RailsEnv production

  <Directory /srv/www/rails/myapp/current/public>
     Require all granted
     Options -MultiViews
  </Directory>
</VirtualHost>

非常感谢任何帮助。

serverfault 上的这个答案暂时帮我解决了这个问题: https://serverfault.com/questions/731814/apachepassenger-not-serving-the-root-of-the-sinatra-application

Kami 在结合 Phusion Passenger 的自动索引模块中引用了 Apache 2.4.17 中的一个错误。

我通过评论 /etc/apache2/mods-enabled/autoindex.load

中的 Loadmodule ... 行禁用了自动索引模块

重新启动 Apache,现在一切正常。