One droplet, 2 domains, but second domain loads to the first domain. What did I do wrong?

Posted September 27, 2018 1k views
ApacheWordPressUbuntu 18.04

I set up a droplet using the Wordpress one click install and configured the virtual host for, which works great! Now the problem lies with me adding a second domain, I followed the same documentation to add the virtual host for this second domain, but somehow when visiting (http://, www, etc), it simply loads instead of’s index file.

This is the document I’ve followed:

I have two virtual host conf files, one for each domain, with the same configuration on each (other than the domain used).
Any idea where I could have messed this up?

Just found that if I go directly to that it loads the correct domain, but the content of

Also, I noticed that the path to index.php that the above URL loads is actually the index in, given that the index located at is an index.html.

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.

2 answers

Hi Logan,

HTTPS is a tricky protocol.

If you have setup a domain with SSL (in this case set to resolve to the server’s main IP. And then add another domain ( ) without assigning a valid SSL for this second domain. Visiting (https) will always resolve to the first vhost in the web server’s configuration, which happens to be

That’s because Apache doesn’t know about the actual host header until it completes the SSL handshake and decrypts the host header for But the latter doesn’t have a valid SSL. So it can’t decrypt (chicken and egg situation). So it defaults to the first virtual host in the Apache configuration.

So you have two options:

  1. Setup a valid SSL for and use Apache (with SNI)

  2. Move to its own IP

You need to use separate document roots for two domains. It sounds like both your domains are pointing the same folder.

Feel free to reach me with the info on my profile page if you need assistance.

Submit an Answer