Showing Directory Root When Launching Rails App Using Apache2 and Passenger
Posted
by
LightBe Corp
on Server Fault
See other posts from Server Fault
or by LightBe Corp
Published on 2012-06-22T19:44:51Z
Indexed on
2012/06/23
15:18 UTC
Read the original article
Hit count: 376
I have done the following in an attempt to host a Rails 3.2.3 application using Apache 2.2.21 and Passenger 3.0.13:
- Installed gem Passenger
- rvmsudo passenger-install-apache2-module
- Added website info in /etc/apache2/extra/httpd-vhosts.conf
- Added line to /etc/hosts (not sure if this was needed or not; not mentioned in Passenger documentation
- Uncommented out the line in /etc/apache2/httpd.conf to Include /etc/apache2/extra/httpd-vhosts.conf
- Restarted Apache
When I try to pull up my website the following displays:
Index of /
Name Last modified Size Description
Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r DAV/2 PHP/5.3.10 with Suhosin-Patch Phusion_Passenger/3.0.13 Server at lightbesandbox2.com Port 443
Here is /etc/hosts entry for the website:
127.0.0.1 www.lightbesandbox2.com
Here is my /etc/apache2/extra/httpd-vhosts.conf entry for the website:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.lightbesandbox2.com
ServerAlias lightbesandbox2.com
PassengerAppRoot /Users/server1/Sites/iktusnetlive_RoR/
DocumentRoot /Users/server1/Sites/iktusnetlive_RoR/public
<Directory /Users/server1/Sites/iktusnetlive_RoR/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
When I do rvmsudo passenger-status I get the following output:
----------- General information -----------
max = 6
count = 1
active = 0
inactive = 1
Waiting on global queue: 0
----------- Application groups -----------
/Users/server1/Sites/iktusnetlive_RoR/:
App root: /Users/server1/Sites/iktusnetlive_RoR/
* PID: 8140 Sessions: 0 Processed: 2 Uptime: 20m 51s
None of my assets are in the public folder in my Rails app. I have written an application using the template presented in Michael Hartl's Ruby on Rails Tutorial. The home page is in /app/views/static_pages/home.html.erb. I decided to copy an index.html file in the public folder to see if it would display. It displayed as I had hoped..
Is there a way to get Passenger to find my assets without me having to rewrite my application?
Any help would be appreciated.
Update 6/23/2012 10:00 am CDT GMT-6
I corrected the problems with my file and have successfully executed the rake assets:precompile command. I still get the index page as before. I have made no other changes. I did a passenger-status command and it is still loaded. Restarting Apache did nothing.
© Server Fault or respective owner