Hi,
I have managed to set up HTTPS on my server. I wish to host two different websites over https so I used this code for two virtual hosts:

<VirtualHost *:443>
DocumentRoot "E:/Program Files/Apache Software Foundation/Apache2.2/htdocs/wm/"
ServerName www.wm.freeform.ath.cx:443
ServerName wm.freeform.ath.cx:443
ServerAdmin samarudge@freeform.ath.cx
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile "E:/Program Files/Apache Software Foundation/Apache2.2/conf/ssl/pp.cert"
SSLCertificateKeyFile "E:/Program Files/Apache Software Foundation/Apache2.2/conf/ssl/pp.key"
<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
</FilesMatch>
<Directory "E:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>
BrowserMatch ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0
CustomLog "E:/Program Files/Apache Software Foundation/Apache2.2/logs/ssl_request.log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>  

<VirtualHost *:443>
DocumentRoot "E:/Program Files/Apache Software Foundation/Apache2.2/htdocs/phproxy/"
ServerName www.pp.freeform.ath.cx:443
ServerName pp.freeform.ath.cx:443
ServerAdmin samarudge@freeform.ath.cx
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile "E:/Program Files/Apache Software Foundation/Apache2.2/conf/ssl/pp.cert"
SSLCertificateKeyFile "E:/Program Files/Apache Software Foundation/Apache2.2/conf/ssl/pp.key"
<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
</FilesMatch>
<Directory "E:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>
BrowserMatch ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0
CustomLog "E:/Program Files/Apache Software Foundation/Apache2.2/logs/ssl_request.log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>

That seems OK but when I restart Apache I get this error:
[warn] _default_ virtual host overlapping on port 443, the first has precidence

And both of the URLs go to the first Virtual Host
How do I fix this?
Regards,
Sam Rudge

Samarudge,

Your problem is that you are using only 1 IP for 2 SSL hosts. Each SSL host must have a unique IP address, otherwise it would be far too easy to spoof secure sites.

You need to have 2 publicly accessible IPs (assuming you want to get to it from the outside) in order to host 2 HTTPS sites on your server.

Also, you must specify the IP in the httpd-ssl.conf config, a la:

<VirtualHost XXX.XXX.XXX.XXX:443>

In the httpd-virtual.conf, it would just be:

<VirtualHost *:80>

Hope this helps.

-Tricnic

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.