whats the better way for multiple subdomains on LEMP

Posted April 19, 2016 2.6k views

i need to create 2 subdomains along with my site in one droplet.

ex: ( simple html based website) ( codeigniter framwork based app) (wordpress)

so should i create separate virtual host for each subdomains or
should i create folders and point those folders using redirect rules in main virtual host file. also is it possible to accomplish my above requirement this way?

please suggest me which method should i chose and why?

thanks in advance

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
1 answer


The recommended and easiest way to do it would be creating a separate server block for each website/subdomain.

Check out the following tutorial:

The tutorial walks you through creating two separate server blocks. You’ll want to create three, one of each domain that you listed.

Make sure you add DNS records for each domain so that they point to your Droplet’s IP address:

by Justin Ellingwood
Nginx is an incredibly powerful web server and reverse proxy. In this guide, we'll discuss how to set up server blocks on Ubuntu 14.04 in order to server multiple domains from a single server.