Using two web servers—two unix sockets needed?

Hi, my use case is a bit strange. I want to have two different web servers serving the same Discourse instance on two different networks.

Can I use the same container and socket (/var/discourse/shared/standalone/nginx.http.sock) for both, or do I have to configure a separate container and/or unix socket for the second web server?

Thanks.

We run nginx in front of discourse.

Setting the upstream to the same server would probably work.

upstream discourse {
    server 127.0.0.1:8080;
		keepalive 32;
}
1 Like

Will the hostname be the same in both instances?

No it will be different.

You’re going to run into some issues having two different hostnames. Discourse is built to use one hostname, so not only is routing involved, but email, generation of links, etc.

Going the route you want, one path of access is going to get the correct hostname from Discourse, and one will not, thus resulting in lots of broken things.

3 Likes

Darn. Any other suggestions? It’s fine if emails use only the original hostname, and maybe I could handle the links being wrong using webserver rewrites. It doesn’t matter if the second hostname is a slightly degraded user experience provided that the messages are all visible and posting via the website is possible.

We also recently added a middleware that will enforce the site hostname.

Why do you want do do this?

It’s because we want to make the forum accessible on the Tor network.

So check this out

4 Likes