SSL and Virtual Hosts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SSL and Virtual Hosts



I am having problems setting up SSL in Virtual Hosts. I have multiple
virtual hosts on the same IP (this setup works great on unsecure sites).
However, with SSLEnabled areas, no matter which site I go to, I get the
first ssl site.

Here are my VirtualHosts

<VirtualHost 10.0.30.4>
        ServerAdmin webmaster@www.site-one.com
        DocumentRoot /data/www/site-one/htdocs
        ServerName www.site-one.com

        ScriptAlias /cgi-bin/ /data/www/site-one/cgi-bin/
</VirtualHost>

<VirtualHost 10.0.30.4:443>
        ServerAdmin webmaster@www.site-one.com
        DocumentRoot /data/www/site-one/htdocs
        ServerName www.site-one.com
        Port 443

        SSLEnable
        SSLCertificateKeyFile /opt/apache/conf/certs/site-one.com.key
        SSLCertificateFile    /opt/apache/conf/certs/site-one.com.cert

        ScriptAlias /cgi-bin/ /data/www/site-one/cgi-bin/
</VirtualHost>

# -------------------------------------------------------

<VirtualHost 10.0.30.4>
        ServerAdmin webmaster@www.site-two.com
        DocumentRoot /data/www/site-two/htdocs
        ServerName www.site-two.com

        ScriptAlias /cgi-bin/ /data/www/site-twoe/cgi-bin/
</VirtualHost>

<VirtualHost 10.0.30.4:443>
        ServerAdmin webmaster@www.site-two.com
        DocumentRoot /data/www/site-two/htdocs
        ServerName www.site-two.com
        Port 443

        SSLEnable
        SSLCertificateKeyFile /opt/apache/conf/certs/site-two.com.key
        SSLCertificateFile    /opt/apache/conf/certs/site-two.com.cert

        ScriptAlias /cgi-bin/ /data/www/site-two/cgi-bin/
</VirtualHost>

# -------------------------------------------------------

<VirtualHost 10.0.30.4>
        ServerAdmin webmaster@www.site-three.com
        DocumentRoot /data/www/site-three/htdocs
        ServerName www.site-three.com

        ScriptAlias /cgi-bin/ /data/www/site-three/cgi-bin/
</VirtualHost>

<VirtualHost 10.0.30.4:443>
        ServerAdmin webmaster@www.site-one.com
        DocumentRoot /data/www/site-three/htdocs
        ServerName www.site-three.com
        Port 443

        SSLEnable
        SSLCertificateKeyFile /opt/apache/conf/certs/site-three.com.key
        SSLCertificateFile    /opt/apache/conf/certs/site-three.com.cert

        ScriptAlias /cgi-bin/ /data/www/site-three/cgi-bin/
</VirtualHost>

10.0.30.4 is the IP of the server. It works great on Sites that are port
80. But hell breaks loose on Sites that are 443 as when I hit
www.site-three.com, I still get www.site-one.com (even though the url
string says www.site-three.com)

Am I doing virtualhosts incorrectly? Can I shrink them into one instead
of having two for each? Why could I have such problems, any ideas?

Thanks a lot in advance
Victor