[warn] module passenger_module is already loaded
Following the basic instruction to install Phusion Passenger and Apache2 for a Ruby on Rails server I ran into this error: “[warn] module passenger_module is already loaded” on restarting my Apache server…
…at last I addressed the problem and fixed it.
Given that my software versions are :
- Apache/2.2.14 (Ubuntu)
– Phusion Passenger version 3.0.11
If you follow passenger installing instruction with this version of Apache you may actually tell Apache to load passenger twice.
Before adding the 3 famous lines to your Apache configuration file:
LoadModule passenger_module /usr/…/ext/apache2/mod_passenger.so
Check the configuration file apache2.conf for lines like these:
# Include module configuration:
If these lines do exists it means that on start your Apache server will copy every every *.conf and *.load file from /mods-available to /mods-enabled and than include them.
So if you run in the concerning warning message it means you are loading passenger module twice!
You can take advantage of this Apache feature going to /mods-available, looking for passenger.conf and passenger.load files and edit them instead of apache2.conf.
The ‘LoadModule passenger_module’ line goes into passenger.load, while the other 2 ‘PassengerRoot’ and ‘PassengerRuby’ lines go into passenger.conf.
Then restart your server and you’ll be fine.
Please note that the same mechanism is applied to /sites-available and /sites-enabled, this means that you can take advantage of this mechanism as well including your passenger Virtual Host declarations like:
In /sites-available instead of including them directly in your apache2.conf file!
I think this approach is cleaner and even more maintainable than the one suggested by the passenger installer.
If you found this post useful you may follow me.