Hi,
My apache server responds to requests for domains that it is not configured for. There is something wrong with my virtual host configuration. Though, I tried a couple of different things myself, I couldnt solve it yet.
I have 4 sites configured on my apache.
1- example.com.conf
Code:
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName www.example.com
DocumentRoot /var/www/example.com/public_html/
ErrorLog /var/www/example.com/logs/error.log
CustomLog /var/www/example.com/logs/access.log combined
</VirtualHost>
2- drop.example.com.conf
Code:
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName drop.example.com
DocumentRoot /var/www/drop.example.com/public_html/
ErrorLog /var/www/drop.example.com/logs/error.log
CustomLog /var/www/drop.example.com/logs/access.log combined
</VirtualHost>
3- webmail.example.com.conf
I use this only to forward http requests to https
Code:
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName webmail.example.com
Redirect / https://webmail.example.com
</VirtualHost>
4- s.webmail.example.com.conf
Code:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin admin@example.com
ServerName webmail.example.com
DocumentRoot /var/www/webmail.example.com/public_html/
ErrorLog /var/www/webmail.example.com/logs/error.log
CustomLog /var/www/webmail.example.com/logs/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/localcerts/example.pem
SSLCertificateKeyFile /etc/ssl/localcerts/example.key
</VirtualHost>
</IfModule>
Everything works fine with this config but the problem is it also works extra.
I have an DNS entry like xyz.example.com and when I try to reach that domain name through my browser like
http://xyz.example.com Virtual Host #2 is being served and when I try to reach it with a secure connection like
https://xyz.example.com the site #4 is being served by apache.
I don't want that. I don't want any sites being served from my apache unless I specifically configure for it and yet I don't have a configuration for xyz.example.com
I tried a couple of things myself, like using ServerAlias directive and some more but didn't help so far.
Please help me to configure my apache properly.
Thanks...