Apache2 VirtualHost subdomains not working?
I have a static public IP and I am hosting my websites on it (Ubuntu Server 12.04). I need to set up a subdomain but It’s not working, even www. is not working. I bought the domain from GoDaddy and I set up the correct NS
I saved the configuration file in
/etc/apache2/sites-available under domain.me and then I did
a2ensite domain.me and reloaded and restarted apache2, but still no luck.
This is my configuration file
<VirtualHost *:80> ServerAdmin firstname.lastname@example.org ServerName domain.me ServerAlias www.domain.me DocumentRoot /var/www LogLevel warn ErrorLog /var/log/apache2/error.log CustomLog /var/log/apache2/access.log combined </VirtualHost> <VirtualHost *:80> ServerAdmin email@example.com ServerName me.subdomain.me ServerAlias www.me.subdomain.me DocumentRoot /var/www/subdomain </VirtualHost>
curl http://domain.me outputs the index file,
curl http://www.domain.me outputs
curl: (6) Couldn't resolve host 'www.domain.me' and same for the subdomain
I managed to fix it, and for those of you who is having the same problem, make sure you set up the A records
Answered By – george