Rails - 已删除public / index.html - 现在浏览器显示目录结构

时间:2012-12-17 02:32:29

标签: ruby-on-rails apache

我最近在Windows 7上安装了Ruby on Rails。

ruby --version
ruby 1.9.3p327 (2012-11-10) [i386-mingw32]
rails --version
Rails 3.2.9

我正在使用apache并使用以下内容编辑了我的httpd.conf文件:

Listen 3000
DocumentRoot "C:/Users/username/Documents/GitHub/blog/public"

<Directory "C:/Users/username/Documents/GitHub/blog/public">
    Options Indexes +FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

当我去localhost:3000时,我得到了默认的欢迎你乘坐Ruby on Rails!信息。所以我运行了以下命令:

$ rails generate controller home index

创建了我期望的所有文件。然后我编辑routes.rb以获得以下行:

root :to => 'home#index'

当我重新加载浏览器时,不是将我引导到/ app / views / home文件夹中的index.html文件,而是显示我/ public文件夹的目录结构。

有谁知道我可能错过了哪一步?

1 个答案:

答案 0 :(得分:1)

您可能希望删除Indexes或添加-这样-Indexes http://httpd.apache.org/docs/2.2/en/mod/core.html#options