这让我发疯了。
我在同一个 redhat 服务器上运行了 2 个不同的 rails 应用程序。Web服务器是apache,应用服务器是passenger 5.0
App1 - rails 3.0.2 和 ruby 1.9.3
App2-rails 2.0.3 & ruby 1.8.7
App1 工作正常,这是配置:
<VirtualHost *:8081>
ServerName server-xyz
RailsEnv test
DocumentRoot /webapps/test/app1/current/public
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
现在,当我运行 app2 时,它会将我带到默认的 apache 页面并给我以下错误:
Options 指令禁止的目录索引:/webapps/test/app2/current/public/
这是 app2 的虚拟主机:
<VirtualHost *:8081>
ServerName server-xyz
RailsEnv test
DocumentRoot /webapps/test/app2/current/public
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
这是常见的乘客配置:
LoadModule passenger_module /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/passenger-5.0.8/buildout/apache2/mod_passenger.so
PassengerRoot /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/passenger-5.0.8
PassengerDefaultRuby /opt/ree-1.8.7/bin/ruby_with_env
PassengerLogLevel 1
PassengerMaxPoolSize 10
任何人都知道为什么它适用于 ruby.1.9.3 应用程序而不适用于 ruby 1.8.7?
我尝试关注类似的线程,但无法使其正常工作。
编辑:我给了 'apache' 对该路径的写权限。似乎没有帮助。
编辑 2:我在公共下找到了以下 .htaccess 配置:
/webapps/test/app2/releases/20150622171404/public/.htaccess
# General Apache options
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI
RewriteEngine On
# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
# Alias /myrailsapp /path/to/myrailsapp/public
# RewriteBase /myrailsapp
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]