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
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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:
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 @
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.