How to install discourse with nginx as proxy on specific path?

Hi. I was able to successfully install and run discourse on my Linux machine with nginx as ssl terminator and with proxy_pass directive.

The problem is, I was able to do it just as discourse.example.com and I’m trying to achieve it to work as example.com/discourse. I’ve tried changing DISCOURSE_HOSTNAME and putting it straight there, but the result is a standard ‘ops, page not found’ site without any css formatting. I’ve tried to grep soure and documentation in search for ‘baseurl’ directive (as it’s a common thing to name it this way in other apps) but no luck.

Is it even possible? If so, please point me to any link describing how to do it.

Follow Subfolder support with Docker

3 Likes

Did you look at Subfolder support with Docker or Discourse in a subfolder, multiple servers sharing a domain?

1 Like

Ok, ‘subfolder’ is the keyword here. I would never guessed that, thanks!

Btw. this document assumes I’m using bundled nginx, not my own, but I suppose I just need to modify my configuration accordingly (especially rewrite line).

You will be using your external nginx as well as an internal nginx that is inside the discourse docker container.

Right. At first I was thinking that I’m not using any internal httpd, as I don’t expose ports, but - silly me - I still use socket which has to be connected to something.

So I have to use rewrite on both of them?