问题描述
我在passenger-3.0.9 和apache2 上设置了rails 应用程序.但是当通过 apache2 即 http/localhost 执行 rails 时,它会显示 rails 应用程序文件结构.而不是运行应用程序.我的日志是
I setup rails app on passenger-3.0.9 and apache2. But when in execute rails through apache2 i.e http/localhost it shows the rails app file structure.and not run the app. My logs are
[2011 年 11 月 12 日星期六 21:20:36] [通知] Apache/2.2.17 (Ubuntu)Phusion_Passenger/2.2.11 PHP/5.3.5-1ubuntu7.3 with Suhosin-Patch配置——恢复正常操作
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www/project_name
<Directory /var/www/project_name>
Options Indexes FollowSymLinks -MultiViews AllowOverride all Order allow,deny allow from all
</Directory>
</VirtualHost>
推荐答案
将您的 DocumentRoot 设置为您的公共文件夹,以便:
Set your DocumentRoot to your public folder so:
DocumentRoot /var/www/project_name/public
在生产中,如果您使用 capistrano 进行部署,这可能会变成
In production if you deploy with capistrano this would likely become
DocumentRoot /var/www/project_name/current/public
您还需要将您的目录设置更新到公共文件夹.
You also need to update your Directory setting to the public folder as well.
如果您的虚拟主机没有指向您的公用文件夹,Apache 不知道从哪里正确地为您的应用程序资产提供服务.
If your virtual host isn't pointing to your public folder Apache doesn't know where to serve your applications assets from properly.
这篇关于乘客和 Apache2 显示文件目录结构而不是应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!