how to set up nginx server blocks (virtual hosts)?

November 7, 2013 2k views
I have a Ubuntu LAMP server with nginx as the front end proxy to access site1.mine.com. I need to set up two more accounts/virtual hosts on the same server (site1a.mine.com, site1b.mine.com) pointing to the same IP. I have these subdomain names created and pointing to the DigitalOcean server IP. However, I can't use the 'How To Set Up Apache Virtual Hosts on Ubuntu 12.04 LTS' tutorial since I am using nginx as the front end proxy. I understand that nginx doesn't have virtual hosts, but instead uses server blocks. I'm looking for any guidance/tutorial on how to do this. Thanks.
1 Answer
Did you checkout https://www.digitalocean.com/community/articles/how-to-set-up-nginx-virtual-hosts-server-blocks-on-ubuntu-12-04-lts--3
by Etel Sverdlov
This tutorial shows you how to set up a new directory, how to grant the correct permissions, how to add content to a new page, how to turn on virtual hosting, and how to, if needed, set up local hosts. Virtual Hosts are used to run more than one website or domain off of a single server and IP address. When used with nginx, virtual hosts are called Server Blocks. This tutorial covers setting up server blocks on an Ubuntu server.
Have another answer? Share your knowledge.