httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John McIntyre <joh98....@gmail.com>
Subject [users@httpd] Virtual Hosts Possible for SSL ?
Date Tue, 01 Oct 2013 15:25:05 GMT
Hi,
I have an apache 2.2.15 instance running on a CentOS 6.4 server.

This server is (or will be, if I ever get it working...) two domains.  One
of them has an SSL certificate, and one doesn't.  I've been struggling with
this for two days solid, and if my research is correct, then the SSL
handshake takes place before the browser sends the server name, and so what
I'm trying to do isn't possible.  Is this true?

The appropriate sections from my httpd.conf are as follows:

NameVirtualHost *:80

<VirtualHost domain1.com:80>
    ServerAdmin root@domain1.com
    DocumentRoot /var/www/html
    ServerName domain1.com
    ErrorLog /var/log/httpd/error_log
    CustomLog /var/log/httpd/access.log combined
    Redirect permanent / https://domain1.com/
</VirtualHost>

<VirtualHost domain1.com:443>
    SSLEngine On
    SSLCertificateFile /etc/httpd/ssl/httpd.pem
    SSLCertificateKeyFile /etc/httpd/ssl/httpd.key
    ServerAdmin root@domain1.com
    ServerName domain1.com
    DocumentRoot /var/www/html
    ErrorLog /var/log/httpd/error_log
    CustomLog /var/log/httpd/access.log combined
</VirtualHost>

<VirtualHost *:80>
        ServerName domain2.com
        ServerAlias domain2.com *.domain2.com
        DocumentRoot /var/www/html/domain2
</VirtualHost>

Here is what I *want* to happen.

i) User types http://domain1.com into his browser.  The server
automatically redirects this to the secure connection, namely http*s*://
domain1.com.  This content is in /var/www/html

So far, this works perfectly.

ii) User types http://domain2.com into his browser.  The server sends back
what is in /var/www/html/domain2

This doesn't work.  In fact, what happens is that whenever someone asks for
domain2, he gets domain1.

Am I doomed to failiure, or is what I'm trying to do, actually possible?

Thanks.

Mime
View raw message