nginx domain resolves to incorrect site

I’m trying to host two domains on a single droplet. and correctly shows content from /home/public/domainA/index.php correctly. just shows, whereas it should be showing the content of /home/public/domainB/index.php.

Both domains are using digitaloceans nameservers, have an entry in sites-available and sites-enabled.

domainA nginx config:

server { listen 80;

    root /home/public/domainA/;
    index index.php index.html index.htm;


domainB nginx config:

server { listen 80

    root /home/public/domainB/;
    index index.php index.html index.htm;


Any help resolving this matter would be much appreciated!


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.

The config seems correct. <br> <br>You can run sudo nginx -t to check config errors. <br> <br>If no error found, the cause may be elsewhere. <br> <br>You can try ls -l /etc/nginx/sites-enabled/ <br>To check where the symlinks point to. <br> <br>Or just delete domainA’s link from sites-enabled and restart/reload nginx to see what happen. <br> <br>

themadman300, no it’s just the relevant snippet. I’ve pasted both configurations here if you’d like to see: <br> <br>Tony Tsang, copy paste error. The above URL has complete config. <br> <br>bossryan, I’ll try your suggestion. Thanks.

semicolon is missing after this line of’s config: <br> <br>listen 80