I have my apache server set up and working with my domain name and one subdomain. Today I tried to add a second subdomain and for the life of me cannot get it to work.

If I go to mydomain.com, I get the main page from /var/www/www

If I go to sub1.mydomain.com, I get the content from /var/www/sub1

However, when I go to sub2.mydomain.com I get the content of /var/www/www instead of /var/www/sub2

I copied the entry for the first subdomain and changed all the parts that said sub1 to sub2 (servername and documentroot), but for some reason it still falls to default.

Running apache2ctl -S shows that the second subdomain isn't being registered, although the config file is loading (I have them all in one). Also the log files didn't seem to have anything in them about this, I'll recheck that in the morning.

I searched all afternoon for this and have not found anything that works. Any suggestions?

  • Have you looked at a2ensite and a2dissite? – ssnobody Sep 9 '14 at 23:51
  • Yes, the virtual host blocks are all in the same file, and that file is linked in the sites-enabled folder. – LEGEND383 Sep 10 '14 at 7:58

Figured it out, turns out the symlink from sites-available to sites-enabled was actually broken for some reason. Removing the 000-default file in sites-enabled and re-linking fixed it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.