Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails app only displaying public directory with passenger

My rails app will only display the public directory when I go to the url. I'm using apache, passenger and ubuntu. My apache virtualhosts file is;

<VirtualHost *:80>
    ServerName www.phusion.nl
    DocumentRoot /websites/phusion
    <Directory /websites/phusion>
        Allow from all
    </Directory>

    # These have been added:
    Alias /subapp /websites/rails/public
    <Location /subapp>
        PassengerBaseURI /subapp
        PassengerAppRoot /websites/rails
    </Location>
    <Directory /websites/rails/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>

I think everything is installed properly, my config.ru is;

require ::File.expand_path('../config/environment',  __FILE__)
run Rails.application

I've added the following to apache2.conf;

LoadModule passenger_module /home/vps/.rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.35/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
   PassengerRoot /home/vps/.rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.35
   PassengerDefaultRuby /home/vps/.rvm/gems/ruby-2.0.0-p353/wrappers/ruby
</IfModule>

the apache error.log gives;

    All Phusion Passenger agents started!
    [ 2014-01-19 09:05:23.8076 12140/7f1e3695c740 agents/Watchdog/Main.cpp:526 ]: 
Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/home/vps/.rvm/gems/ruby-2.0.0-p353/wrappers/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/home/vps/.rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.35', 'passenger_version' => '4.0.35', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.35', 'web_server_pid' => '12137', 'web_server_type' => 'apache', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
like image 221
raphael_turtle Avatar asked Jan 18 '14 16:01

raphael_turtle


2 Answers

duh...

I had PassengerAppRoot set to the public folder, not rails root.

like image 93
raphael_turtle Avatar answered Oct 02 '22 23:10

raphael_turtle


This issue may be because of the way you installed the Passenger module

Wrong way : sudo passenger-install-apache2-module

Right way : rvmsudo passenger-install-apache2-module

I am just guessing you used the first one which is leading to this issue, please correct me if i'm wrong.

like image 21
Nikhil Nanjappa Avatar answered Oct 02 '22 23:10

Nikhil Nanjappa