【问题标题】:Passenger starting on all urls except the root url乘客从除根 url 之外的所有 url 开始
【发布时间】:2015-10-26 13:29:20
【问题描述】:

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

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

这是我的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>

非常感谢任何帮助。

【问题讨论】:

    标签: ruby-on-rails apache passenger


    【解决方案1】:

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

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

    我通过在/etc/apache2/mods-enabled/autoindex.load 中注释Loadmodule ... 行来禁用自动索引模块

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

    【讨论】:

    • 不幸的是,这对我没有用 - 我试过了,但没有解决问题。
    • 你是世界上最好的人:D
    猜你喜欢
    • 2020-11-27
    • 2018-11-20
    • 1970-01-01
    • 1970-01-01
    • 2015-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多