你如何设置apache在服务器上显示rails应用程序? 我的rails应用程序在本地主机上运行良好,但是当我转到外部站点时,它给了我索引信息
喜欢这个
Name Last modified Size Description
[TXT] 404.html 21-May-2012 21:38 728
[TXT] 422.html 21-May-2012 21:38 711
[TXT] 500.html 21-May-2012 21:38 643
[IMG] favicon.ico 21-May-2012 21:38 0
[TXT] robots.txt 21-May-2012 21:38 204
这是我的虚拟主机信息
<VirtualHost *:80>
ServerAdmin example@example.com
ServerName server.example.com
# ServerAlias
DocumentRoot /var/www/sample_app/current/public
ErrorLog /var/www/sample_app/error.log
RailsEnv production
<Directory "/var/www/sample_app/current/public">
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
好吧,可能不是这样,但以下是乘客文档的建议:
<VirtualHost *:80>
ServerName www.mycook.com
DocumentRoot /webapps/mycook/public
<Directory /webapps/mycook/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
明确指出,MultiViews与乘客不兼容。
所以你可以试试:
- 删除"索引"选项
- 指定
-MultiViews
而不是MultiViews
老实说,我尝试将索引添加到我的生产应用程序中,因为我认为这可能只是导致问题的这个选项,但它并没有改变任何东西......因此,它可能会解决您这边的问题,这有点"疯狂猜测"。
更新从另一个答案中,您可以尝试添加PassengerResolveSymlinksInDocumentRoot
选项:
<VirtualHost *:80>
ServerName www.mycook.com
DocumentRoot /webapps/mycook/public
<Directory /webapps/mycook/public>
Allow from all
Options -MultiViews
PassengerResolveSymlinksInDocumentRoot on
</Directory>
</VirtualHost>