Directory listing instead of Rails site after Pass

2019-07-26 19:58发布

问题:

Having updated Passenger and Ruby Enterprise Edition to the latest versions today, I am now seeing a directory listing instead of my Rails app. Here's the Passenger part of my Apache config:

#LoadModule passenger_module /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/passenger-2.1.3/ext/apache2/mod_passenger.so
#PassengerRoot /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/passenger-2.1.3
#PassengerRuby /opt/ruby-enterprise-1.8.6-20090201/bin/ruby

LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
PassengerRoot /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11
PassengerRuby /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby

RailsEnv production
RackEnv production

PassengerMaxPoolSize 30
PassengerPoolIdleTime 600
PassengerMaxInstancesPerApp 10
PassengerUseGlobalQueue on

This config is definitely being loaded, the vhost is definitely pointing at the public directory of the app. The app itself works fine when run from the Rails console.

You'll see in the config above that the old passenger settings are commented out. If I comment out the new Passenger lines and uncomment out the old ones (i.e. switch to the older version of passenger), the app works fine again.

Tried reinstalling passenger/REE, no difference. There are no relevant entries in the Apache error log or Rails log.

Any help appreciated!

回答1:

I was able to solve this using:

PassengerResolveSymlinksInDocumentRoot

It seems that Passenger no longer handles public directories that are symlinks to your app elsewhere by default. Turning this option on fixed all the issues.



回答2:

I realized that I had /etc/hosts pointing the public URL of my app to 127.0.0.1 for my test callbacks in twitter.

It will simply keep showing a blank file listing. removed the entry from /etc/hosts and everything came back to normal