Install Discourse on a droplet with WordPress served by Apache ?

Posted January 28, 2020 471 views
NginxApacheCMSUbuntu 18.04

Hello everyone ! :)
I’m really puzzled by a little problem with my personnal website project : I can’t manage to install any Discourse instance on my droplet, with already WordPress and Apache installed.

I know there are already many threads for this. But they don’t exactly fit to my case : Install Discourse in a Docker container, with Apache used to serve WordPress.

For example, this thread is for installing WordPress on a droplet with Discourse. But I need the reverse :

And this one is for installing Discourse on a droplet / server with WordPress served by Nginx. But my WordPress is served by Apache :

So it doesn’t fit to my situation.

The manipulations are probably 95% similar between Apache and Nginx, but I don’t want to do any mistake.

I could use a separate droplet for Discourse, but I need to use Discourse’s API to share its database with a custom social network app, created by the main programmer of my project. And it also uses a JSON add-on installed on the WordPress instance.

So it will be way simplier if I can install all that stuff on the same droplet. Without any conflicts.

  • Apache is listening to port 80.

  • My droplet uses Ubuntu 18.04.

  • Discourse will be installed on a subdomain : DNS records are already done.

Any tips or suggestions are welcome ! :)

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


This is a really good question.

I’ve tried to replicate your setup and create a step by step guide on how to set Discourse on a Droplet with Apache and an existing Wordpress installation. To be honest it took me a while to figure the whole process out.

Here are the steps that you would need to take:


  • To be on the safe side make sure to backup your Droplet, so that in case anything goes wrong, you could revert back to a working version

  • SSH to your Droplet

Step 1 - Install Docker

To install Docker please follow the steps here:

Step 2 - Download Discourse

First, create a directory where you would store your Discourse files:

mkdir /var/discourse

After that clone the official Discourse Docker Image into /var/discourse.

git clone /var/discourse

Step 3 - Configure Discourse to listen on port 8080

We will use the standalone.yml template it includes all of the necessary services like PostgreSQL, Redis and etc.

You copy the sample file with the following command:

cp /var/discourse/samples/standalone.yml /var/discourse/containers/app.yml

After that edit the file with your favorite editor. Open the /var/discourse/containers/app.yml and update and the ports on lines 23 and 24:

## which TCP/IP ports should this container expose?
  - "8080:80"   # fwd host port 8080   to container port 80 (http)
  - "8443:443"   # fwd host port 8443 to container port 443 (http)

Also if you do not yet have an SSL certificate make sure to comment line 16 out:

  #- "templates/web.ssl.template.yml"

Just add the # symbol in front of the - "templates/web.ssl.template.yml line otherwise Discourse would not start.

Step 4 - Setup Discourse

Then, start Discourse (as this is the first time that you are starting the service it would bootstrap the application with the new changes that you have in your app.yml file):


Note: Make sure to provide valid Mail server settings as otherwise, the setup might fail.

Step 5 - Setup Apache

In your /etc/apache2/sites-available/ create a new file called and add the following Vhost content:

<VirtualHost *:80>

  <IfModule proxy_module>
    ProxyPreserveHost on
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
  • Enable the Vhost with the following command:
  • Enable Mod Proxy:
a2enmod proxy
a2enmod proxy_http
a2enmod proxy_balancer
a2enmod lbmethod_byrequests
  • Restart Apache:
systemctl restart apache2

And after that, you would be able to access Discourse directly via your domain name.

Hope that this helps!

by Brian Hogan
Docker is an application that simplifies the process of managing application processes in containers. In this tutorial, you'll install and use Docker Community Edition (CE) on Ubuntu 18.04. You'll install Docker itself, work with containers and images, and push an image to a Docker Repository.
Submit an Answer