So I want all this on one server:
- 3 domains / websites
- SSL on one of them
- nothing to be accessed by an IP address (e.g. 'domain.com' is okay, but not by just typing '123.55.44.123' into the browser)
I am using:
- Ubuntu 12.04 LTS
- Apache
I have set these virtual hosts up and everything works perfectly for non-SSL
<VirtualHost *:80>
ServerName 123.55.33.123
DocumentRoot /var/www/random-empty-folder
<Directory />
Options FollowSymLinks
Deny from all # notice the deny here
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.domain-one.com
ServerAlias domain-one.com *.domain-one.com
DocumentRoot /var/www/domain-one
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.domain-two.com
ServerAlias domain-two.com *.domain-two.com
DocumentRoot /var/www/domain-two
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
...etc. for 'domain-three'
The problem is that I can't get this configured for SSL. My standard SSL setup is this, but that allows access using the IP address. I just need to stop that:
<VirtualHost *:443>
ServerName www.domain-two.com:443
ServerAlias domain-two.com *.domain-two.com
DocumentRoot /var/www/domain-two
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
There's also a 'default-ssl' site/file which is disabled, so not sure if I should be doing something with that. I've tried enabling it and making changes, but mostly I run into a 'default duplicate' error.
So, based on the above setup, I just need to block access to [https]://123.55.44.123. Thanks in advance.
I do always run 'service apache2 reload' after making changes, just in case anyone is wondering.