Wednesday, April 20, 2016

Passenger starting on all urls except the root url

Leave a Comment

I'm trying to deploy a rails 4.1.0 application to my production environment with apache (2.4.17), rvm and passenger (4.0.59).

The problem is, I keep getting the apache directory listing of the public directory when I go to the url (www.myapp.com) of my vhost. But: When I navigate to a route inside my rails-app, e.g; www.myapp.com/pages/1 passenger starts the application and everything works as expected.

This is my passenger.conf:

# /etc/apache2/conf-enabled/passenger.conf LoadModule passenger_module /home/sander/.rvm/gems/ruby-2.1.0-preview2/gems/passenger-4.0.59/buildout/apache2/mod_passenger.so     <IfModule mod_passenger.c>        PassengerRoot /home/sander/.rvm/gems/ruby-2.1.0-preview2/gems/passenger-4.0.59        PassengerDefaultRuby /home/sander/.rvm/gems/ruby-2.1.0-preview2/wrappers/ruby      </IfModule> 

I checked the apache module was loaded:

>> apache2ctl -M ... passenger_module (shared) 

Virtual host config:

<VirtualHost my-ip:80>   ServerName www.myapp.com   ServerAlias myapp.com    DocumentRoot /srv/www/rails/myapp/current/public   PassengerAppRoot /srv/www/rails/myapp/current   RailsEnv production    <Directory /srv/www/rails/myapp/current/public>      Require all granted      Options -MultiViews   </Directory> </VirtualHost> 

Any help is very appreciated.

1 Answers

Answers 1

This answer on serverfault helped me solve this for now: http://serverfault.com/questions/731814/apachepassenger-not-serving-the-root-of-the-sinatra-application

Kami referenced a bug in Apache 2.4.17 in the autoindex module in combination with Phusion Passenger.

I disabled the autoindex module by commenting the Loadmodule ... line in /etc/apache2/mods-enabled/autoindex.load

restarted Apache, and everything works now.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment