0

我在我的 RoR 服务器上创建了一个新项目,我想重定向 apache 以从我的 app/views/home/index.html.erb 中获取新的索引文件,但它似乎不起作用。

这是我创建新索引文件之前的虚拟服务器 conf 文件

<VirtualHost *:80>
    ServerName www.example.com
    ServerAlias example.com
    DocumentRoot /var/www/html/blog/public
    ErrorLog logs/example.com-error_log
    CustomLog logs/example.com-access_log common
<Directory /var/www/html/blog/public>
        Allow from all
    PassengerEnabled off 
    Options +Indexes +FollowSymLinks -MultiViews
</Directory>
</VirtualHost>

在我删除了 public/index.html

<VirtualHost *:80>
    ServerName www.example.com
    ServerAlias example.com
    DocumentRoot /var/www/html/blog/app/views/home/
    ErrorLog logs/example.com-error_log
    CustomLog logs/example.com-access_log common
<Directory /var/www/html/blog/app/views/home/>
        Allow from all
    PassengerEnabled off 
    Options +Indexes +FollowSymLinks -MultiViews
</Directory>
</VirtualHost>
4

2 回答 2

1

完全编辑最后一个答案

请发布您的路线文件,但将您的 DocumentRoot 行改回

DocumentRoot /var/www/html/blog/public

您指向您的公共目录,您的路线将告诉应用程序显示 app/home/index,而不是 apache(如果您使用的是应该使用的 rails)。

在 config/routes.rb 确保你有这条线root :to => 'home#index'

更新 1

检查显示 Options 的行是否有正确的参数,并且更重要的是您需要它。http://httpd.apache.org/docs/current/mod/core.html#options就我个人而言,我使用 nginx 和 unicorn,但我不记得当我搞乱Passenger 时那句话。

于 2012-11-18T00:35:17.370 回答
0

我修好了它。我必须在 httpd.conf 中指定 RailsEnv,然后触摸 tmp/restart.txt

于 2012-11-18T19:25:48.350 回答