Abe Stewart Abe Stewart - 1 month ago 8
Apache Configuration Question

Multiple apache subdomains - main domain and subs all same CNAME, IP and PORT. One subdomain works, the other doesn't

I am trying to create a setup so that I have the following three domains:

mydomain.com
files.mydomain.com
mail.mydomain.com


I have managed to get the first two to work but the third keeps redirecting back to the main domain instead.

In /etc/apache2/sites-enabled/ I have three .conf files. The first:

<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /var/www/wordpress
...
</VirtualHost>


The second:

<VirtualHost *:80>
ServerName files.mydomain.com
DocumentRoot /var/www
Alias /media /home/user/cloud/media
....
</VirtualHost>


and the third:

<VirtualHost .*:80>
ServerName mail.mydomain.com
DocumentRoot /var/www
Alias /mail /usr/share/mail
....
</VirtualHost>


All three have been a2ensite'd and I have restarted apache2. Any ideas what I am doing wrong? Cheers!

Answer

There is a dot:

<VirtualHost .*:80>
             ^
             ^
             ^
Comments