Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I thought I had ssl set up correctly, but I discovered a problem.

This part is OK: goes to

But this isn't working: is going to, which happens to be the first vhost on the machine. In other words, I have a non-SSL vhost running on that server, and is bouncing to that one.

I used this utiltiy and verified that my Commodo "PositiveSSL" certificate covers the domain both with and without the "www".

I'm using Apache 2.2.3-65.

Here's my config in /etc/httpd/conf.d/ssl.conf...

<VirtualHost *:443>
    DocumentRoot "/opt/deployed_rails_apps/ssl_site/current/public"

    SSLEngine on
    SSLCertificateFile /etc/pki/tls/certs/
    SSLCertificateKeyFile /etc/pki/tls/certs/
    SSLCACertificateFile /etc/pki/tls/certs/
    SSLHonorCipherOrder On
    SSLCipherSuite ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH
    SSLProtocol all -SSLv2
    Header add Strict-Transport-Security "max-age=15768000"

    ErrorLog "logs/"
    CustomLog "logs/" common
    CustomLog "logs/" deflate
    <Directory "/opt/deployed_rails_apps/rock_pebble/current/public">
        Options -MultiViews FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all

# apachectl -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:443         (/etc/httpd/conf.d/ssl.conf:230)
*:80                   is a NameVirtualHost
         default server (/etc/httpd/conf/httpd.conf:232)
         port 80 namevhost (/etc/httpd/conf/httpd.conf:232)
Syntax OK
share|improve this question
What's the output from apachectl -S? – Shane Madden Jul 13 '12 at 4:40
See updated question. Thanks. – Agvorth Jul 13 '12 at 6:30
That config looks good - the ssl.conf vhost will always get every request to port 443, regardless of what host header is on the request. Are you accessing, or – Shane Madden Jul 13 '12 at 22:09
Ah OK, yeah. Entering "" does what I want -- takes you to "";. Entering "" serves up the page that's really at "", but the browser address bar contains "";. The status code is 200. – Agvorth Jul 14 '12 at 18:06
Is there some way I can redirect "" to ""? Maybe at the DNS level? – Agvorth Jul 14 '12 at 18:08

You can't redirect at the DNS level, but you can easily configure another virtual host on port 80 to handle the redirects.

<VirtualHost *:80>
    # .. logging, anything else you need ..
    Redirect permanent /
share|improve this answer
up vote 0 down vote accepted

OK, thanks for the help, everyone. I think I have this figured out. I set up both a non-SSL vhost in httpd.conf and the SSL vhost as described in my question in ssl.conf.

The non-SSL vhost has this...


And the SSL vhost has only this...


Within my application code, I'm forcing all traffic to go to the corresponding https URL. Now the URL resolves both with and without the "www" and everything is served over SSL.

share|improve this answer

Your Answer


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.