Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passenger could not be initialized because of this error: Option 'agents_dir' missing in file - Rails 4 + Passenger deployment

I have been banging my head against a door trying to deploy a Rails 4 app on Ubuntu 14 + Apache2 + Passenger. I seemed to have made some progress: passenger is installed properly with the proper apache modules, my apache conf files are set up, everything is restarted, etc.. when I go to my site I get a listing of my Rails App's public directory. I investigated the logs and found the following:

Passenger could not be initialized because of this error: Option 'agents_dir' missing in file '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini'

I different SO post said something about mods-available stuff so here's /etc/apache2/mods-available/passenger.conf:

<IfModule mod_passenger.c> PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini PassengerDefaultRuby /usr/bin/ruby </IfModule>

And /etc/apache2/mods-available/passenger.load:

LoadModule passenger_module /usr/lib/apache2/modules/mod_passenger.so

What am I doing wrong? I'm going to kiss whoever solves this, I swear.

like image 732
karns Avatar asked Mar 13 '15 01:03

karns


3 Answers

I just ran into this problem and fixed it by reinstalling the passenger package using the following command:

sudo apt-get install --reinstall passenger passenger-dev
like image 189
Chris Mytton Avatar answered Nov 07 '22 06:11

Chris Mytton


If you happen to have same issue while Upgrading Nginx and Passenger on Ubuntu 14.04

sudo apt-get purge passenger
sudo apt-get remove nginx (it won't remove your config files)

and then

sudo apt-get install nginx-full passenger
like image 39
chemic Avatar answered Nov 07 '22 06:11

chemic


locations.ini is a passenger + ngnix config related item, and does not apply for passenger + apache config.

See the Phusion Passenger users guide, Apache version for details about how to configure passenger with apache.

Or see Phusion Passenger users guide, Nginx version for configuring passenger with nginx.

If you are going the passenger + apache route, the key step you seem to be missing is to run passenger-install-apache2-module which provides the right values for PassengerRoot, PassengerDefaultRuby, etc.

like image 39
Prakash Murthy Avatar answered Nov 07 '22 05:11

Prakash Murthy