Newly added domain shows an old one

I am on Ubuntu 14.04 with Apache and have several virtual hosts on this droplet. All of them work fine, apart from the one I added yesterday which keeps loading the files from another existing site. The domain itself is not redirected, so I suspect there is either some sort of cache involved or (which is more likely) there is something wrong with the listener setup. It seems that the server just picks the first folder that comes after the 000-default in the alphabetic order and serves it when requests come for the new domain.

So to summarize it plain and simple, the situation can be described thus:

There are domains/sites A, B and C on the same droplet/IP. Having added domain D in the same manner as the other three, when I access http://(www).D.tld, the content I see belongs to site A.

I tried to remove it and then add again to the DigitalOcean DNS Panel, but nothing changed. Rewrote the virtual host directives several times, checked it in 4 browsers, cleared cache and still nothing. Any suggestions?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Good point about the DNS, thanks. As for all the rest, I tried it a few times before posting, but all in vain. Anyway, it seems that it requires some deep digging into the server settings which I don’t have time for at the moment. In the meanwhile I’ve enabled this site on another droplet in the very same manner, and all works fine. Go figure

When you open that domain in browser (or ping it) and you get to your server, that means it points correctly and there are no problems with DNS settings (so removing and adding from DNS panel will not help).

Go though a simple make sure list:

  1. Make sure vhost file is written correctly.
  2. Make sure you enabled site using a2ensite command.
  3. Make sure you restarted apache after settings are done:
  1. sudo systemctl restart apache2

Maybe for debugging purpose you can try disabling 000-default If enabled, restart apache and check again.

Also you can clear out browser cache or use another one.

If you want to learn more about it, you can look at How to set up virtual hosts for Apache on Ubuntu 16.04.