Subdomain server block doesn't work
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?
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.×