Running other websites on the same machine as Discourse

I was able to successfully install Discourse and now I’m trying to work out how to use a Apache virtualhost to pass the traffic to the forum. I’ve started a new thread for that:

1 Like

Solved. See the linked thread.

1 Like

Thank you Kane, I decided to install Discourse in another droplet and it worked (originally!), now I’m having a little bit of an issue, maybe you or another community member will be able to help!

I’d like to note that the launchpad PPA is maintained by volunteers and is not distributed by nginx.org. I recommend installing nginx as per their installation instructions. the launchpad PPA is not updated as regularly and this may cause issues with newer versions of OS’s such as Ubuntu 20.04 focal since there’s no release file for focal in the launchpad.

Personally, I’m using this PPA for Ubuntu: Ondřej Surý in Launchpad
You can choose the stable or mainline version. It’s usually well supported.
There are also for PHP and Apache2.

2 Likes

That one seems better maintained than the other PPA, it also has Focal support I see.

Hi Angus,
Thanks for sharing the extra tips to support the first thread. Am having issues with SSL cert and Key names issue. I can see from the below error. That’s the issue (i donno what else could be)

Am not 100% sure what changed need to be done according to this.

As others mentioned, I had to change the ssl cert and key names in the discourse.conf :

`When i go to my discourse.conf, this below what i see. (PS: Previously there wasn’t any discourse.conf file in /nginx/sites-enabled/ . So i created it just now)


could you advice ? or others?

UPDATE: Need to mark this as solved as the name should be like this

(Just figured out)

But havign 502 gateway and figuring out. Thanks @EricGT even though for checking that.

1 Like

I would check the file types. I suspect that crt should be cer.

3 Likes

If you don’t have a AAAA record no sense in checking for IPv6 address, e.g. listen [::]:80;

Check with IPv6 test - web site reachability

1 Like

Sorry what do you mean by that? This is not a fresh installation and been installed for 2years. so if i missed AAAA, that means i should have missed before. or do you mean I need to do this DNS setup now?

2 Likes

It is more of a friendly suggestion.

The site I am helping to set up, the domain name does not have a AAAA record, e.g. there is no IPv6 address associated with the domain name, so if you use the domain name to get to the site, e.g. discoure.xyz.org it will not be converted to a IPv6 address but only a IPv4 address.

The site IPv6 test - web site reachability will tell you if have a AAAA record or not. If you don’t then you can just remove listen [::]:80; from the configuration.

Sometime, many moths to years down the road if someone is changing the domain name or something then they can check into getting a AAAA record.

Personally for our site I am doing just as suggested. There is no AAAA record so I am remvoing listen [::]:80; and not doing anything more as I don’t have the admin rights for the domain name. :grinning:

1 Like

Everything seems to work fine, except for the discobot certificate which gives me an 500 error :roll_eyes:
Failed to process hijacked response correctly : Failed to open TCP connection to example.com:443 (Connection refused - connect(2) for "example.com" port 443)
Is it possible that a front nginx (setup as in the OP) doesn’t play nice with the hijack module ?

1 Like

Is it reasonable to implement multiple discourse containers with the socketed template?

For instance, could you create and include (in, for example app2.yml) something like web.socketed2.template.yml, and swap out this line:

       listen unix:/shared/nginx.http.sock;

with:

       listen unix:/shared/nginx.http.sock2;

Then direct the reverse-proxy to connect to both?

I tried this and it didn’t work, but I’m not yet sure if this can’t work or if it’s something else in my config.

1 Like

@jetatomic discourse don’t recommended multi-site with discourse

That interpretation is a misrepresentation. What that post and several others say is that it’s an advanced topic with Pros and Cons. I have multisite with web_only and data running exactly as described in the post you referenced.

I’m just trying to learn how this works. Unix domain sockets isn’t exactly the hottest conversation on the internet.

4 Likes

Yeah, multi-container is slightly tricky because you need to update the /shared volume host path and I don’t think any of the #howto’s explicitly call that out yet. And if you have that level of trickiness, might as well just go full multisite…

You can change the notificition email per-site, but they all have to use the same SMTP server.

Plugins do have to be the same on all multisite instances and some plugins don’t support multisite.

2 Likes

Before I came to this thread I read an article Install and Run Discourse behind Nginx the Right Way, First Time! It is already quite old (2016) so I’ll use instructions from here instead, but I was wondering about one thing. The article mentions:

We disabled the "templates/web.ratelimited.template.yml" because, our Inner Nginx tends to think only one IP address is trying to make multiple connections, which isn’t true.

See, when the Outer Nginx takes the incoming request, it funnels all the request to the Inner Nginx [the one inside Discourse docker image] as a single user from a single IP. This gives the inner Nginx the impression a user is trying to bombard it with recurring multiple requests.

This causes Nginx to go in a stalemate. Disabling this here, but enabling it in the outer Nginx will actually be what we’re looking for.

Is that still a valid argument I should take into account?

1 Like

If you’re running into that, that means correct user IPs are not making it into Discourse, which is something you should fix without removing the template.

2 Likes

Thanks! I’ll just leave it in then. I have the forum running already, and it looks good. Great instructions.

1 Like