Rails app only displaying public directory with passenger
Asked Answered
M

2

9

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' }
Mir answered 18/1, 2014 at 16:56 Comment(5)
Could you give a full path to the rails app on your server? Do you really want to deploy the app to the sub URI?Maleficence
It has to be a sub uri. The full path is /var/www/subappMir
Why Directory points to /websites/rails/public if your app is in /var/www/subapp?Maleficence
it doesn't, just an exampleMir
It would be nice if you could give us a real content of your configuration files.Maleficence
M
5

duh...

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

Mir answered 21/1, 2014 at 10:10 Comment(2)
hello, could you illustrate more what you did to fix this? I'm in a similar situationGuerrero
fyi I'm using AWS + OpsWorks... not sure what you were working withGuerrero
L
3

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.

Laddie answered 21/1, 2014 at 7:12 Comment(1)
I installed with rvmsudoMir

© 2022 - 2024 — McMap. All rights reserved.