Error: LoadModule takes two arguments (when configuring Passenger in httpd.conf)


While configuring Apache + Phusion Passenger + Ruby on Rails I encountered a few error messages:


[root@webapps ~]# service httpd reload
Reloading httpd: not reloading due to configuration syntax error
        [FAILED]

[root@webapps ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: httpd: Syntax error on line 221 of /etc/httpd/conf/httpd.conf: LoadModule takes two arguments, a module name and the name of a shared object file to load it from                             [FAILED]

[root@webapps ~]# service httpd restart
Stopping httpd:                                            [FAILED]
Starting httpd: Syntax error on line 1039 of /etc/httpd/conf/httpd.conf:DocumentRoot takes one argument, Root directory of the document tree
                                                           [FAILED]

Notes:

 

When I opened my httpd.conf file and looked at line 221 (as indicated in the first error) it looked like everything was fine. Then took a closer look and noticed an errant space in the LoadModule directive.


I had entered:

LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p0/gems/passenger- 3.0.11/ext/apache2/mod_passenger.so

Note: There is a space after passenger- and before 3.0.11 which should not be there

Where I should have entered:

LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.11/ext/apache2/mod_passenger.so

 

After correcting the issue I restarted apache and found another error on line 1039 of httpd.conf. This was down in the virtual host directive I had setup for my rails app:

<VirtualHost *:80>
   ServerName Domain.tld
   DocumentRoot /var/www/apps/railsApp/public # <-- be sure to point to 'public'!
   <Directory /var/www/apps/railsApp/public>
      AllowOverride all # <-- relax Apache security settings
      Options -MultiViews # <-- MultiViews must be turned off
   </Directory>
</VirtualHost>


Line 1039 in my file is the DocumentRoot line (point to 'public' line above). As I didn't see anything wrong, I tried removing the comment from the end of the line (I had copy/pasted from the passenger example). Removing all of "in-line" comments from the Virtual Host directive allowed me to start apache / httpd with no errors.

Here is correct/working VirtualHost directive:

<VirtualHost *:80>
   ServerName Domain.tld
   DocumentRoot /var/www/apps/railsApp/public
   <Directory /var/www/apps/railsApp/public>
      AllowOverride all
      Options -MultiViews
   </Directory>
</VirtualHost>

As an aside: I had to uncomment NameVirtualHost *:80 in my httpd.conf file as I want to host multiple sites from this apache server.