Hi all,

I’ve been trying my best to work this out myself but I’m coming up short on this one. I have a Ubuntu 16.04 Droplet that I’ve setup with LEMP and Wordpress. All of that is working fantastically. I can connect to it through my domain name and it all just works as it should.

What I want to do now setup a community page on my droplet. So at the moment I have my Wordpress site pointing to www.mydomain.com and I want to add a subdomain for a community page which is community.mydomain.com but I am unsure what is the best way to go about doing this.

Any help would be appreciated

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


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:

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:

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:

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...
Submit an Answer