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

Posted November 7, 2013 3.3k views
I have a Ubuntu LAMP server with nginx as the front end proxy to access I need to set up two more accounts/virtual hosts on the same server (, 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.

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.

1 answer
Did you checkout
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.
Submit an Answer