问题
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
[Sat Nov 12 21:20:36 2011] [notice] Apache/2.2.17 (Ubuntu) Phusion_Passenger/2.2.11 PHP/5.3.5-1ubuntu7.3 with Suhosin-Patch configured -- resuming normal operations
<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>
回答1:
Set your DocumentRoot to your public folder so:
DocumentRoot /var/www/project_name/public
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.
If your virtual host isn't pointing to your public folder Apache doesn't know where to serve your applications assets from properly.
回答2:
Did you set PassengerAppRoot
attribute?
DocumentRoot
points toward the static part of the app while PassengerAppRoot
is used to point towards the rails application
Here's an article about it
来源:https://stackoverflow.com/questions/8105592/passenger-and-apache2-display-file-directory-structure-rather-than-application