Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have the exact same configuration for my rails site on a staging server and a production server, aside from the "staging" vs "production" in the file paths.

They're both set up to redirect all requests on port 80 to the SSL version on 443.

This works properly on staging, but in production it's just showing the default Apache test page. Apache doesn't seem to be forwarding the requests to passenger. My rails logs are empty. The apache logs show all of the requests, but there are no errors.

Any ideas?

At the end of httpd.conf:

LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.19
PassengerRuby /usr/local/bin/ruby

Include /etc/httpd/conf/extra/httpd-vhosts.conf

vhosts.conf:

NameVirtualHost *:80

<VirtualHost *:80>
  ServerName  goodtogotraining.com
  ServerAlias www.goodtogotraining.com
  Redirect permanent / https://www.goodtogotraining.com/
</VirtualHost>

<VirtualHost www.goodtogotraining.com:443>
   ServerName  goodtogotraining.com
   ServerAlias www.goodtogotraining.com
   DocumentRoot /home/goodtogo/production/current/public
   PassengerMaxPoolSize 18
   RailsEnv production

   SSLEngine on
   SSLCertificateFile    /etc/pki/tls/certs/ca.crt
   SSLCertificateKeyFile /etc/pki/tls/private/ca.key
   SSLCACertificateFile  /etc/pki/tls/certs/ca.crt

   <Directory /home/goodtogo/production/current/public>
     Options -MultiViews
     Allow from all
   </Directory>
</VirtualHost>
share|improve this question

1 Answer 1

up vote 3 down vote accepted

You used a fully qualified domain name in your SSL <VirtualHost>.

<VirtualHost www.goodtogotraining.com:443>

Apache recommends against this.

A fully qualified domain name for the IP address of the virtual host (not recommended);

To resolve the issue, use the IP address or * instead:

<VirtualHost *:443>
share|improve this answer
    
Thanks, using the IP fixed it! Any ideas why the staging version worked with the domain name instead? –  jemminger Jun 3 '13 at 17:33
1  
You probably had it in /etc/hosts. Anyway, even if it is there, you should avoid this for performance reasons (it has to do the lookup on every request). –  Michael Hampton Jun 3 '13 at 17:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.