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?

The developer cloud

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

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.