What is the best practice approach to set up a Wordpress site with a Discourse Community subdirectory, from scratch?

I’m starting from scratch and have read dozens of tutorials and am trying to figure out the best approach for a novice to build a WP site with Discourse on the same droplet, as a subdirectory (not a subdomain, if possible). I also want to make sure i’m not missing any critical components.

WP Site: Discourse Community:

Here’s some things I want to make sure I get right… out of the gate:

  1. I want to be sure that I’m adding the proper layer of security
  2. I want to make sure I am setting up the DNS properly for these two diff tools
  3. I want to make sure my SSL certs are in place for both tools (or maybe I only need for the main domain ¯\ (ツ)/¯ )
  4. I’ve read a bit about caching and I want to make sure that’s set up to optimize the UX

From what I’ve looked up, here’s the process I’m looking at following:

  1. Create a new Droplet
  2. Install and Deploy a LEMP stack (should I use this 55 second method?)
  3. Then I was thinking that I should set up 2 Server blocks (or Virtual Hosts) as outlined here: How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu 16.04
  4. Then install Wordpress on one server block?
  5. Then install Discourse on another server block?

My trouble is that there is sooooo much great info (tutorials) in these forums/documentation but I don’t know which documentation to follow, in which order… b/c I couldn’t figure out the best order of operations here.

PS. I’m understanding most of what I’m reading as I’ve been learning about the LEMP stack and NGINX, etc. but I don’t have any expereince with backend development. I have a moderate to advanced understanding of HTML and CSS and a theoretical understanding of Javascript… but that’s it!

Would I do well to install and run this stuff through a WHM/cPanel?

I just divorced GoDaddy shared hosting and am excited to build my site on a VPS droplet here, with DigitalOcean!

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello friend!

I saw your post on the Discourse community earlier today. In this case I truly believe you are choosing the most difficult path that could be chosen to accomplish this task. I want you to be aware of that because I want you to know that if you go ahead with it, it will bring headaches and few will likely be able to eyeball your configuration to determine the correct path to resolution as problems occur. I don’t want to make that out to be any less frustrating than it will be. I’d like to point out that the person who said this on the Discourse community is Jeff, the creator of Discourse:

“I strongly advise you to abandon the idea of running Discourse in a subfolder. It is SEO snake oil, and adds massive amounts of complexity to what would otherwise be a really simple subdomain hosting configuration.”

Note that Discourse is not similar software to WP, it cannot simply be placed under Wordpress as though the web server can drop into that folder and process the contents of it separately. The way that it’s developers package it, you’re going to be running it in Docker with it’s own web server and all (but push it to a non-standard port). This is going to cause you to pay for a droplet large enough to handle both jobs, and that will not save money over having two droplets (I’d say 4-6GB RAM to safely handle both jobs in the way that you’re going to have to do this).

With all that said, if you do go down that path, note that a subdirectory of a domain is not it’s own server block. It would be contained within one server block. Additionally, Wordpress requires URL rewrites for the pages you create on it (no one ever uses it without that enabled). So you’re going to tell Wordpress that it can write* (wildcard, meaning “anything”) with exception to /community (rewrite override), and have /community serve as a reverse proxy to the Discourse installation. While there will be no guide for accomplishing this, the most important detail you’re going to need is found here:

As someone who runs a Discourse community and hates seeing people dig holes that are difficult to dig out of later, I beg of you to run two droplets and point a subdomain at the Discourse installation. You will sleep so many more nights ahead for having done so :)

Kind Regards, Jarland

@jarland , I’ve seen several instances of tutorials for installing both Discourse and Wordpress on the same droplet. (Discourse as a subdomain, NOT as a subdirectory). Would you recommend for or against this in terms of site performance, ease of Virtual server maintenance, and cost-effectiveness? <-- There they discuss doing it - albeit that was 2014.

Has either DO or Discourse platform evolved such that separate droplets are a superior choice? I appreciate your input in advance, thank you!

@jarland Thank you for the thoughtful and thorough response!

You’ll be happy to note that I’ve decided to abandon my original plan to have Discourse as a Subdirectory. This type of discussion is exactly what I was hoping to explore so that I could understand what the true “best practice” is for running Wordpress and Discourse harmoniously.

It sounds like the best way to do this would be to have one droplet for each.