I have a RoR web app that I'm trying to serve up with Passenger on Apache. The weird thing is that I can access the web app if I use Passenger Standalone, but I can't seem to access the web app using Apache with the Passenger module.
The passenger module appears to be running as evidenced by the fact that I can start Apache with no errors and that Passenger-status returns the following:
----------- General information -----------
max = 6
count = 0
active = 0
inactive = 0
Waiting on global queue: 0
----------- Application groups -----------
When I try to access the web app I get a listing of the public folder directory.
Here is my virtual hosts file:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /home/smith/www/dashboard/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/smith/www/dashboard/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I have the following at the end of my apache2.conf file:
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger 3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11
PassengerRuby /usr/bin/ruby1.8
I am pulling my hair out trying to figure this out. Would appreciate some help with this.
Thanks.
passenger-status looks at the current status of a Phusion Passenger installation. It will locate Phusion Passenger automatically if it is running and will give you a list of instances if there is more than one Phusion Passenger instance running.
The Passenger Apache module registers Passenger-specific configuration options inside Apache. You, the administrator, configure Passenger by adding Passenger-specific configuration options to the Apache configuration file. Restart or reload Apache to apply any configuration changes.
Location of the log file By default, the Passenger log file is the global (not the per-vhost) Apache error log file. This is typically located in /var/log/apache2/error_log . You can find out the exact location of the error log by running passenger-config --detect-apache2 .
The Passenger Nginx module registers Passenger-specific configuration options inside Nginx. You, the administrator, configure Passenger by adding Passenger-specific configuration options to the Nginx configuration file. Restart or reload Nginx to apply any configuration changes.
After weeks of trial and error I have finally been able to fix this by RTFM. I am surprised that there were no responses to my question on Stackoverflow and I was not able to find any other articles elsewhere that helped with my question. This issue has to be affecting everyone who is deploying a RoR app using Capistrano on a Linux server running Apache2 and Passenger.
I have Capistrano deploying the app to /home/smith/www/dashboard which creates a current folder which symlinks to releases/
Passenger needs to find config/environment.rb to launch the Rails app. By default, Phusion Passenger assumes that the application’s root directory is the parent directory of the public directory.See: http://www.modrails.com/documentation/Users%20guide%20Apache.html#PassengerAppRoot
The problem is that when using Capistrano, by default it deploys the app to
/home/smith/www/dashboard/current/
So by default Passenger reckons the path to be:
/home/smith/www/dashboard/config/environment.rb
Passenger provides the ability to set the PassengerAppRoot configuration option in Apache virtual host file like so:
PassengerAppRoot /home/smith/www/dashboard/current
This allows Passenger to find the config/environment.rb file correctly:
PassengerAppRoot /home/scervera/www/dashboard/current/config/environment.rb
Here is the rest of my virtual host file:
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /home/smith/www/dashboard/current/public
<Directory /home/smith/www/dashboard/current/public>
Options FollowSymLinks
AllowOverride none
Order allow,deny
Allow from all
</Directory>
PassengerAppRoot /home/smith/www/dashboard/current
</VirtualHost>
There may be other ways to fix this, but I believe this is "by the book".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With