Installing Discourse Forum on Virtualmin

OS type and version REQUIRED
Webmin version REQUIRED
Virtualmin version REQUIRED
Related packages SUGGESTED

how we can install the discourse on the current install

I am hoping to get some more information how to install on virtual where other websites are running

It’s no different in Virtualmin (vs virtual hosting Discourse behind Apache on a system without Virtualmin). You’d proxy to the Docker-contained server running it.

This is a reasonable discussion on the topic (be careful if doing additional searches, the top result when searching for this is an insane guide that proxies through both Apache and HAProxy, which is a ridiculous thing to do):

nginx is pretty similar, if you’re using it. I’m sure there’s docs for that, too. But, as with Apache, if you see a crazy bunch of stuff in the mix, it’s probably wrong. This is not complicated and doesn’t need a bunch of extra software! Apache (or nginx) can proxy to a Docker container very easily with no additional stuff! Anything that suggests nginx+Apache is also crazy and senselessly complicated. Just Apache and mod_proxy will do the thing, assuming Docker is configured to expose the app on a local file socket (a local port would also work, but on a shared virtual hosting system, file sockets are safer, because a file, or rather the directory the file is in, can be owned by the user that owns the app).

I’ve discussed this in the past, as well. But, the most important thing is:

ProxyPass / unix:/var/discourse/shared/socket-only/nginx.http.sock|http://localhost/
ProxyPassReverse  / unix:/var/discourse/shared/socket-only/nginx.http.sock|http://localhost/

Note the socket can be wherever you put the Discourse directory, including in a domain owner home directory. This is just the path you’d use if installing Discourse exactly according to the docs, and then changed Docker to listen on a socket rather than directly on an IP and port 80/443 (which can’t happen on your Virtualmin system because Apache or nginx is already there).

1 Like

And, as always, if you want to use Let’s Encrypt in Virtualmin or via certbot using web validation, you’d also need to exclude the .well-known path, and let it be served from the file system. Again, this is always true, nothing special about Discourse or Virtualmin being involved.

Did you have a look at How to install Discourse alongside Virtualmin ?

I have subserver, for example: with a proxy path, and the main virtualserver uses * wildcard letsencrypt ssl certificate, will renewal of the certificate work?

For * (i.e. wildcard) certificates, a renewal will only work with DNS validation; web-server validation will be simply skipped.

I recommend against wildcard certs, in the general case.

Just wanted to add that if you install discourse as per the instructions here, if you enable https from inside discourse you will be unable to login. It will just give you “unknown error” and Error 403. Also “bad csrf”

in apache add these lines to fix:

RequestHeader set X-Forwarded-Proto expr=%{REQUEST_SCHEME}
RequestHeader set X-Real-IP expr=%{REMOTE_ADDR}

you can force ssl externally but then the email templates will all mention http instead of https

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.