I'm using Apache2 and named virtual hosts to serve two different dotcom's (exampleone.com
and exampletwo.com
) from one IP address. One site (exampleone.com
should be HTTP and HTTPS, while the other (example2.com
) should serve HTTP only.
So far I've gotten their respective HTTP sites working as expected, and I've gotten HTTPS working for the site it's intended for--however when I go to https://exampletwo.com
I'm being served https://exampleone.com
content and security warnings.
How do I get https://exampletwo.com
requests to be rejected?
<VirtualHost 1.2.3.4:80>
ServerName exampleone.com
ServerAlias *.exampleone.com
DocumentRoot /var/www/exampleone.com
<Directory /var/www/exampleone.com>
Options MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
CustomLog /var/log/apache2/exampleone.log combined
</VirtualHost>
<VirtualHost 1.2.3.4:80>
ServerName exampletwo.com
ServerAlias *.exampletwo.com
DocumentRoot /var/www/exampletwo.com
<Directory /var/www/exampletwo.com>
Options MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
CustomLog /var/log/apache2/exampletwo.log combined
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost 1.2.3.4:443>
ServerAdmin admin@exampleone.com
ServerName exampleone.com
ServerAlias *.exampleone.com
DocumentRoot /var/www/exampleone.com
<Directory /var/www/exampleone.com>
Options MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
CustomLog /var/log/apache2/exampleone-ssl.log combined
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
# A self-signed (snakeoil) certificate can be created by installing
# the ssl-cert package. See
# /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
# If both key and certificate are stored in the same file, only the
# SSLCertificateFile directive is needed.
SSLCertificateFile /etc/ssl/certs/exampleone.com.crt
SSLCertificateKeyFile /etc/ssl/private/exampleone.com.key
</VirtualHost>
</IfModule>