Passenger is a great thing because it makes Rails apps able to be deployed on Apache.
The installation is pretty painless, but there are a few gotchas you may want to know about.
Start here: http://www.modrails.com/install.html
sudo gem install passenger
The installation will prompt you to add this to your httpd.conf file: (note the version number of passenger might be different)
LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-2.1.3/ext/apache2/mod_passenger.so
If you are NOT using the Passenger preference pane, follow these instructions to add a virtual host to your Apache configuration file, and set its DocumentRoot to /somewhere/public. If you ARE using the passenger preference pane, you don’t need to do this.
Allow from all
SOME COMMON PROBLEMS
When first installing passenger (sudo gem install passenger), I get this error:
Building native extentions. This could take a while…
ERROR: Error installing passenger:
ERROR: Failed to build gem native extensions
FIX: Type ‘make’ at the command prompt. If you get the error “make: command not found,” then you don’t have ‘make’ (gcc compiler) installed, so your system can’t build anything. Install XCode Tools to solve this.
SYMPTOM: Site loads but it does not go to your rails app correctly.
FIX: Check to make sure apache config file, or the file you included in apache config, is correct. Try putting your site at a different port like this:
Remember to restart apache each time you make a change with:
sudo apachectl restart
SYMTPOM: Browser says “500 Internal Server Error”
FIX: Check the Apache error log (Applications > Utilities > Console, click “Show Log List” if the list of logs does not appear, go to /var/log/apache2/error_log )
SYMPTOM: *** Passenger ERROR:Could not spawn the sever the server… Permission denied
FIX: If you are running a custom ruby executable (see custom ruby executable with passenger), you may not have set your custo ruby executable file to have execute permissions.
SYMPTOM: Routing error … no route for /YourApp
FIX: If you see this in your browser (where /YourApp is the name of your app), it is probably because you did not have this in your Rails config/environment.rb file:
Rails::Initializer.run do |config|
config.action_controller.relative_url_root = “/YourApp”
SYMPTOM: Ruby on rails version ‘2.3.1’ not found
(or some other version)
FIX: Upgrade rails (or install the needed Rails version, more than one can run at once):
sudo gem install rails –version 2.3.1
SYMPTOM: Apache does not respond in the browser.
FIX: Make sure that apache is started ok, try this to see if there are any errors in your httpd.conf file:
sudo apachectl configtest