I have an Apache running on an Ubuntu Server (14.04). I've configured the DNS A records and VH in order to have one domain and two subdomains just like this:
- example.com
- subdomain1.example.com
- subdomain2.example.com
Everything is running ok, but the problem is that when I try to access to my website by the server ip, the browser shows subdomain1.example.com content instead of example.com content. This is not happening if I type example.com, in this case everything goes ok, but I'm worried if this could be a problem in the future or if I've done something wrong...
Here is my Apache VH config for example.com and subdomain1.example.com (subdomain2 is exactly like subdomain1):
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ServerAdmin contact@example.com
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName subdomain1.example.com
ServerAdmin contact@example.com
DocumentRoot /var/www/subdomain1
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Hope I've explained well... Thank you!