ruby-on-rails - 乘客从除根 url 之外的所有 url 开始

标签 ruby-on-rails apache passenger

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

问题是,当我转到我的虚拟主机的 url (www.myapp.com) 时,我不断获得公共(public)目录的 apache 目录列表。但是:当我导航到我的 rails-app 内的路线时,例如; www.myapp.com/pages/1乘客启动应用程序,一切都按预期工作。

这是我的乘客.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 在 Apache 2.4.17 中结合 Phusion Passenger 的 autoindex 模块引用了一个错误。

我通过评论 Loadmodule ... 禁用了自动索引模块输入 /etc/apache2/mods-enabled/autoindex.load
重新启动 Apache,现在一切正常。

关于ruby-on-rails - 乘客从除根 url 之外的所有 url 开始,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33347007/

相关文章:

ruby-on-rails - 获取正在测试的实例变量 Controller 方法的值

ruby-on-rails - 将 Discourse SSO 与现有 Rails 站点与 Devise 相结合

apache - Centos:无法检索镜像列表

ruby-on-rails - rails 3 : Passenger can't find git gems installed by bundler

ruby 1.9.3-p0 乘客 "Symbol not found: _ruby_current_thread"

ruby-on-rails - 为多个 Ruby-on-Rails 应用程序运行多个版本的 Passenger

ruby-on-rails - Rails 的 assert_difference 是否忽略了一些变化?

mysql - rails 4 : Using ActiveRecord object from one thread in another

python - 使用 Flask 的 Apache Web 服务器,部署我的 Web 应用程序

mysql - 地理冗余和 MySQL 复制