By gnohpcntt
Hi, I’m creating a new subdomain (sub.example.com) on the same droplet as my main domain (example.com). I’m able to ping the subdomain and check DNS (https://www.digitalocean.com/community/tools/dns). However, whenever I come to sub.example.com, it still redirect me to my main domain’s content (the bar still shows sub.example.com). My main domain is a wordpress website. My sub.example.com.conf on etc/nginx/sites-available: server { listen 80; root /var/www/sub.example.com; index index.html index.htm index.nginx-debian.html; server_name sub.example.com www.sub.example.com; location / { try_files $uri $uri/ =404; } }
Hosts file: myip sub.example.com
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!
@gnohpcntt here is your checklist:
hosts file to ensure that sub.example.com point to the actual IP of your droplet./etc/nginx/sites-available folder. So don’t forget to create a symlink to it in the /etc/nginx/sites-enabled folder too.You should read Step Four: Enable your Server Blocks and Restart Nginx for more details.
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
To be clarify, when i go to sub.example.com it should shows the index.html I created, but it redirect me to sub.example.com/users/login and shows the login page for user on my main domain.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.