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

AI-generated summary

A user, ftpd, successfully installed Discourse with nginx as an SSL terminator and proxy pass, but only as a subdomain (discourse.example.com). They want to achieve the same setup, but with a specific path (example.com/discourse).

ftpd tried changing the DISCOURSE_HOSTNAME and searching for a ‘baseurl’ directive, but to no avail.

Falco and pfaffman pointed ftpd to relevant resources, including Subfolder support with Docker and Discourse in a subfolder, multiple servers sharing a domain.

ftpd realized that ‘subfolder’ was the key term and that the documentation assumes a bundled nginx setup. They plan to modify their configuration accordingly.

ftpd understands that they will need to use both an external nginx and an internal one within the Discourse Docker container, and pfaffman confirmed that ftpd will need to use rewrite on both the internal and external nginx setups.

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 Serve Discourse from a subfolder (path prefix) instead of a subdomain

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

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?