I'm trying to perform a fresh install of Ruby on Rails running with Apache2/Passenger on Ubuntu. I was able to successfully install apache2, rvm, ruby, rails and passenger, the latter part following this tutorial. All the installations went smoothly; I end up with these versions of software:
- Ubuntu 11.10 running on Amazon EC2
- Apache 2.2.20
- RVM 1.10.2
- Ruby 1.9.3p0
- Rails 3.1.3
- Passenger 3.0.11
After running passenger-install-apache2-module
the installer recommended me to:
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.11
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p0/ruby
When wiring up Apache2 to use mod_passenger, this is where I run into trouble.
I go to /etc/apache2/mods-available
and edit:
passenger.load
LoadModule passenger_module /usr/lib/apache2/modules/mod_passenger.so`
to
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.11/ext/apache2/mod_passenger.so`
passenger.conf
<IfModule mod_passenger.c>
PassengerRoot /usr
PassengerRuby /usr/bin/ruby
</IfModule>
to
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.11
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p0/ruby
</IfModule>
Then I restart the server via apachectl restart
. When I load the site, I'm greeted with an HTTP error, as viewed from Google Chrome:
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
And when I check the Apache /var/log/apache2/error.log , I find this:
[Thu Jan 19 19:32:07 2012] [notice] Apache/2.2.20 (Ubuntu) Phusion_Passenger/3.0.11 configured -- resuming normal operations
[Thu Jan 19 19:32:09 2012] [notice] child pid 4163 exit signal Segmentation fault (11)`
So it would appear the mod isn't loading or running properly; how do I fix this?
Edit: Extra info
My virtual host:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /somewhere/public
ServerName mydomain.com
ServerAlias *.mydomain.com
RackBaseURI /
RackEnv production
PassengerMaxPoolSize 4
<Directory "/somewhere/public">
Options Indexes FollowSymLinks -MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I spent hours on this issue but was unable to find a simple resolution. I learned that it should be possible to debug this segfault by getting Apache to 'dump cores' or by attaching to the process using gdb, but neither of these were successful in show me any more information about the issue.
Instead, since I was running on EC2, I decided to start with a clean slate by reloading the base Ubuntu AMI again. After going through the meticulous re-installing of all these applications, it ran without the segfault, and I was able to launch my Ruby on Rails server successfully. It's most probable it was something in my configuration or setup to blame (maybe I missed a dependency, installed things in the wrong order?)
If you run into this issue and are at a point where you can easily fresh install, it might be easier that way, rather than wasting hours attempting to chase obscure bugs.