2012-01-29 62 views
1

我想在我的Rails应用程序的“public /”目录的特定子目录上启用Apache目录列表。为了这个讨论,我们假设它是“public/listme”允许从rails“public /”的子目录中列出Apache目录?

我已经设置了Apache选项来启用目录列表,但是如果我要求类似http://mydomain.com/listme的东西,我会收到404错误,如果我检查Rails的日志,我得到这样一个错误:

ActionController::RoutingError (No route matches "/listme")

所以:有一个方法来禁用我的Rails应用程序中的路由特定文件夹,并允许Apache的自动目录列表中踢?

回答

3

事实证明,这个问题在模型文档中得到了解答。见http://www.modrails.com/documentation/Users%20guide%20Apache.html

总结:

假设你在/应用/ foo的Rails应用程序。假设您已经在/ apps/foo/public/wordpress中删除了Wordpress - 一个用PHP编写的博客应用程序。然后,您可以如下配置Phusion Passenger:

<VirtualHost *:80> 
    ServerName www.foo.com 
    DocumentRoot /apps/foo/public 
    <Directory /apps/foo/public/wordpress> 
     PassengerEnabled off 
     AllowOverride all  # <-- Makes Wordpress's .htaccess file work. 
    </Directory> 
</VirtualHost>