C4f1151075b447779af31e99d6cf70e2c6eb47ac
By:
newbie

whats the better way for multiple subdomains on LEMP

April 19, 2016 767 views
LEMP DNS PHP

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

ex: mysite.com ( simple html based website)
site2.mysite.com ( codeigniter framwork based app)
site3.mysite.com (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

1 Answer

Hi!

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 Etel Sverdlov
This article walks you through setting up the DNS for your site. The tutorial includes steps to set up an A records, point your nameservers, and provides some information about MX records.
Have another answer? Share your knowledge.