Adding subdomain on NGINX (CentOS)

January 28, 2014 5.4k views
Hey guys, I had a working nginx config for my domain, but now I want to add a subdomain to the config. I have following virtual.conf in my /etc/nginx/conf.d folder and it looks like this: http://pastebin.com/TByryv10 Basically I just copied the serverblock that was working and changed the server_name and paths. My fist server block is still working, but the subdomain isn't. Any idea what the problem is?
10 Answers
Have you restarted nginx?
Yes I ran: sudo service nginx restart a couple of times.
Did you add A record and Cname to your DNS at DO??

I guess this is what you are missing, check here:

https://www.digitalocean.com/community/articles/how-to-set-up-and-test-dns-subdomains-with-digitalocean-s-dns-panel
by Assaf Gordon
Here's some documentation on how to set up and test DNS subdomains with DigitalOcean's DNS panel.
Oh no I didn't do that, thanks for the info!
The example is more complex than what I want though, not sure if I did it correctly.
I just need to add a CNAME record "subdomain" and "subdomain.appstudions.be." right?
Sorry guys, but it's still not working I set it up like this (http://oi57.tinypic.com/35d9p41.jpg) and waited until the zone file was refreshed and restarted nginx, but I'm not seeing the index.php that's in the folder. I get "Oop Chrome couldn't find ..."
What is the domain name?
www.appstudions.be, but I see appstudions.be doesn't work, which it did before ... maybe the problem is somewhere there?
Remove your domain from DigitalOcean's DNS manager and re-add it as appstudions.be instead of www.appstudions.be
It's working now, thanks a lot for the help!
Have another answer? Share your knowledge.