Running Discourse out of a folder, on a server running Wordpress with Apache, with SSL support

(Jimmy Hooker) #1

I’d like to install Discourse on my server, which already has a live Wordpress website running on Apache. Further, I’d like to run it out of a folder, utilizing SSL. I’m currently running the site on a Digital Ocean 2gb Ubuntu 14.04 droplet.

Wordpress on Apache:

There are a few guides here on how to do pieces of this:

This seems interesting, but I’ve seen warnings against using anything other than an Nginx proxy by Sam:

I’m struggling to bring this all together into a cohesive setup. If I am running discourse out of a folder, can I reference the same cert I’m using for the main website (guessing no)? What’s the best way to reference these with an Nginx proxy config? Do I still reference in the Nginx config if I have the folder setup going in my app.yml (assuming yes since DISCOURSE_HOSTNAME still has to be the subdomain, at least from what I understand).

I’d love it if someone smarter than me could bridge the gaps between all these other guides and create something canonical.


If your cert is for the domain, anything after the domain name is included.

You can use nginx or apache2 on the host. I would recommend nginx if it’s not too complicated. You can either migrate your vhosts on apache2, or keep them and run nginx in front of apache2.

What is “” ? Is this a subdomain for your discourse? This is not a “folder” installation, it’s a subdomain. You will either require a wildcard cert else need another cert for this subdomain.

(Jimmy Hooker) #3

I’d rather stick with Apache ideally, since it’s what I know. But I’m potentially open to switching to Nginx if there’s a good reason.

If you read through Subfolder support with Docker, and check out his subfolder-sample.yml, he references a subdomain under DISCOURSE_HOSTNAME.

Either way, again, I understand pieces of this, but tying all these different guides together is what I need help with.


That’s interesting, I have not gone through this process yet. I saw this on the link.

If you did this with an existing site that wasn’t on a subdomain, you’ll find that your uploads are broken. There’s a tool that can help fix all paths to include the subfolder. In the Discourse directory (typically /var/www/discourse’), run it like this after taking a backup:

So you may do best to first bootstrap with the subdomain, then run through that migration to the subfolder.

Honestly I’ve not had issues with apache2, but if you think your instance will get a lot of traffic, nginx is the superior route for discourse.

Independent of the webserver you choose, I would think the flow would go:

edit local /etc/hosts file or point a-record of subdomain to server
stop hostlevel webserver
bootstrap subdomain
modify app.yml
use websocket template
modify your vhost or server block to handle the websocket
rebuild app.yml

Now as to using SSL with a host-level webserver, I think the easy way might be to terminate at the host, as in not use the SSL template.

Actually, disregard the above … it said if you already have data. If this is a fresh install, I think you can forego adding the subdomain altogether. Either someone else can chime in and give a better answer, or you may have to take a stab at this and experiment for a bit.

(Kane York) #5

You need to have mod_evented or something, otherwise all your Apache workers will be tied up in the long polling requests.

(Jimmy Hooker) #6

Right, I meant just sticking with Apache for Wordpress. It’s just already setup so I’d rather not have to switch to Nginx. But if switching to Nginx makes everything else much easier, I’m into that.