Hello, I hope you are doing great today. From long time I was thinking to write this article on How I had installed WordPress and Discourse on the same server.
If you are on this page then you might have an idea about both the software; Discourse and WordPress. Hence, let’s get started with our installation guide. But before that we need some pre-requisites to be completed and we will be using DigitalOcean Cloud server for this guide.
Note: Read entire guide first and then execute on your server.
- DigitalOcean LAMP Droplet with 2GB RAM (or at least 1GB RAM with 2GB Swap file).
- Point Domain DNS settings to DigitalOcean server.
- PuTTY software for SSH terminal connection (using Windows OS).
- Completely installed WordPress blog or website.
If you completed the pre-requisite, then you are good to go ahead with the tutorial. Next, you need to install and setup the Discourse on DigitalOcean server. Follow this tutorial:
Few things to note while following installation guide.
- If you have 2 GB RAM, you can skip adding Swap file (Step Two) as Discourse can work good enough with 2GB RAM else adding Swap file with 1GB RAM is necessary.
- At Step Five (Configure Discourse); After you open app.yml in the editor, look for expose settings and change port “85:85” to “85:80“. This will assign a different port number (Port 80) for Discourse software and WordPress will use default port 85. Finally, expose setting should look something like this:
## which TCP/IP ports should this container expose?
- "85:80" # fwd host port 85 to container port 80 (http)
- "2222:22" # fwd host port 2222 to container port 22 (ssh)
- Continue with further changes to be done in app.yml file and progress with Discourse installation.
- Stop at Step Seven (Access Discourse); we have just assigned Discourse with a port, but we have not configured with our DigitalOcean Apache setting to listen to this port number.
Follow these steps for Apache configuration:
- Install mod_proxy and mod_proxy_http using following commands for reverse proxy settings.
12sudo apt-get install libapache2-mod-proxy-htmlapt-get install libxml2-dev
- Enable both the apache modules using below command.
Apache12sudo a2enmod mod_proxysudo a2enmod proxy_http
- Create a Virtual Host Apache configuration file for implementing mod_proxy and mod_proxy_http. Name the file as www.example.com.conf and add this below text with the change in ServerName and ServerAlias.
Apache1234567891011LoadModule proxy_module modules/mod_proxy.soLoadModule proxy_http_module modules/mod_proxy_http.so<VirtualHost *:80>ProxyPreserveHost OnProxyRequests OffDocumentRoot "/var/discourse"ServerName www.example.comServerAlias example.comProxyPass / http://localhost:85/ProxyPassReverse / http://localhost:85/</VirtualHost>
- Reload and restart Apache server.
Apache12sudo service apache2 reloadsudo service apache2 restart
- Once you have completed with Apache settings, your Discourse and WordPress are good to go. Now access your Discourse forum through web link and complete further settings which you have stopped at Step Seven.
Note and Conclusion: