Report this

What is the reason for this report?

Subdomain server block doesn't work

Posted on August 4, 2016

Hello, I’m trying to create a subdomain on my server but it’s not working. I have main domain where i host a wordpress also with Let’s Encrypt certificate, everything through tutorials on this site. My DNS is handled by CloudFlare.

So first i turned off CloudFlare services, now it handles only DNS. I also created a new A DNS record which points to the server IP.

Next i created a link of default server block in sites-enabled folder just to make sure everything is working and it is, when i enter IP of my server in browser, nginx welcome page appears. ( but I had to do it in another browser because chrome always translate ip to main domain name )

In the default server block, I changed server name to my subdomain ( something.something.com ) and when I restarted the nginx service a go to my subdomain it didn’t work, it redirected me to the main domain. So I was trying to solve this problem, I also removed my main domain from enabled sites and it still didn’t work.

But when I change the server name in default server block from subdomain to my main domain (main domain server block is disabled), it works (shows nginx welcome page).

What can be a problem?



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!

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.

Ok, I decided to get rid of CloudFlare and everything works now.

do you set cname on your cloudflare. or i think it might being issue of htaccess in wordpress

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.