Virtual Hosts Possible for SSL ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx
    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@xxxxxxxxxxx
    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 https://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.

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux