How to setup vhosts in the DNS page in settings

Posted December 9, 2012 5.7k views
I've setup an ubuntu server with LEMP and phpmyadmin and I've managed to setup an nginx vhost using your tutorial. However, I couldn't see my vhost site until I added an entry on the DNS setup page. Now I see a site, but it's the index.html file in my default web root, not my new vhost web root. But, there's nowhere to specify the web root on the DNS setup page, so how do I let DNS know about the site, but then make sure requests go to the right web root on my server? I'm new to this stuff, but I have to say the tutorials and interface (other than this issue I'm confused on) are great and I'm having fun learning!

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.

Submit an Answer
4 answers
DNS is purely used to map domains and subdomains to the IP of the server.

Which files are served from which directory on the server based on the domain you specified is all handled by your web server, in this case nginx.

The issue you mentioned either indicates that there is an issue with your nginx config, or if everything is correct that you may not have restarted it after making modifications. Anytime you change the nginx config you need to restart the service.

If you paste your nginx config for the domain in question we can see if there are any possible errors in it.
I got it working. I was having issues with a server block that didn't have the 'www' part in it. Live and learn. ;)

So, do I need to create an entry on the DNS page for each domain/subdomain that I add to my server before it'll be browsable?
Looks like that's the case. Thanks!