Prolem: subdomain redirect to maindomain

Hi, I’m creating a new subdomain ( on the same droplet as my main domain ( I’m able to ping the subdomain and check DNS ( However, whenever I come to, it still redirect me to my main domain’s content (the bar still shows My main domain is a wordpress website. My on etc/nginx/sites-available: server { listen 80; root /var/www/; index index.html index.htm index.nginx-debian.html; server_name; location / { try_files $uri $uri/ =404; } }

Hosts file: myip


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

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.

HI @gnohpcntt,

Apart from the other good answers, can you verify the subdomain is actually a blank website or is it a WordPress as well? I’m asking as it’s possible you are using either the same database for your subdomain or having your home url set to your main domain. Check that just in case as well.

Regards, KFSys

@gnohpcntt here is your checklist:

  1. Recheck your hosts file to ensure that point to the actual IP of your droplet.
  2. Your Nginx configuration file looks good. You put it in the /etc/nginx/sites-available folder. So don’t forget to create a symlink to it in the /etc/nginx/sites-enabled folder too.
  3. Reload Nginx to apply changes.

You should read Step Four: Enable your Server Blocks and Restart Nginx for more details.

Hi! That’s good you’ve verified that the DNS is resolving correctly. It seems you are on the right track with a separate nginx conf file for your sub-domain - did you restart nginx after making that file? You probably did but just in case ;)

I also like to try the new DNS / webhost config from multiple browsers and devices - the browsers today will cache the darnedest things. You could do this easily with an incognito window on your workstation and on your phone if thats available. This will verify that the problem is on the server and not just on your computer.

Otherwise, it sounds like your main domain web server (nginx) config might be overriding the subdomain config… here’s an article in the DO knowledgebase with some examples - if you have not already, please review what you have against what is presented in this tutorial:

If you’re still stuck, please share a version of your main domain configuration so we can look for possible conflicts.

Hope this helps and good luck!

To be clarify, when i go to it should shows the index.html I created, but it redirect me to and shows the login page for user on my main domain.