Hi!
You will need Nginx Server Blocks to make this possible
You can learn more about Nginx Server Blocks in this DigitalOcean tutorial.
I will tl;dr part of this tutorial for you, but I recommend to read it so you learn more about it, it is excellent tutorial. :D
How you could do it:
Let’s say you have two sites in:
/var/www/example.com/html
/var/www/community.example.com/html
You need to create server block for example.com and community.example.com.
You can copy default Nginx server block and change it as you wish.
Default server block is located under /etc/nginx/sites-available/default
.
This is how your server block for example.com should look:
/etc/nginx/sites-available/example.com
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/example.com/html;
index index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
...
}
This is how your server block for community.example.com should look:
/etc/nginx/sites-available/example.com
server {
listen 80;
listen [::]:80;
root /var/www/community.example.com/html;
index index.html index.htm index.nginx-debian.html;
server_name community.example.com
...
}
After you config it don’t forget to enable you server blocks! Follow Step Four of given tutorial.
Also you need to create appropriate DNS record for community web site.
If your using DigitalOcean DNS management (Networking -> Domains under DigitalOcean Cloud Panel), you can just add CNAME record community
pointing to @

by Justin Ellingwood
When using the Nginx web server, server blocks (similar to the virtual hosts in Apache) can be used to encapsulate configuration details and host more than one domain off of a single server. In this guide, we'll discuss how to configure server blocks in Nginx on an Ubuntu...