502 bad gateway apache proxy multi site config

nope all is good with proxy modules

If you are able to access it via the direct port then the problem is most likely with your Apache proxy config. That is where I’d be looking.

You should definitely be using localhost or 127.0.0.1 instead of 0.0.0.0, because 0.0.0.0 is just a generic all-interfaces shortcut, so who knows where that traffic is going to head… It was probably luck that it was working with that address earlier.

Thanks for the reply. I have tried like 5-6 directives in the domain’s virtualhost in httpd.conf

Here are they:
Timeout 2400
ProxyTimeout 2400
ProxyBadHeader Ignore
ProxyPass / http://0.0.0.0:8080/ retry=1 acquire=3000 timeout=600 Keepalive=On

But none of them work

SSH into the host and run a curl http://0.0.0.0:8080. Does that work? (Or 127.0.0.1)
If so then I’d quite happily say its something with the proxy directives. Unfortunately I’ve never used Apache as a reverse proxy so I can’t really help you out there.

curl http://0.0.0.0:8080/ gives curl: (56) Recv failure: Connection reset by peer but so does localhost:8080 and 127.0.0.1:8080

I have tried this in httpd.conf same results

Is something blocking loopback connections then? Firewall?

:bulb: You’re running CentOS. Is SELinux enabled? That might be blocking Apache from opening connections.

Try setsebool -P httpd_can_network_connect to allow Apache to open connections.

Check here apache 2.2 - SElinux: allow httpd to connect to a specific port - Server Fault for more details on allowing specific ports.

Thanks again for the input. iptables has no rule for 8080 port ACCEPT or REJECT, netstat tells that
tcp6 0 0 :::8080 :::* LISTEN 15160/docker-proxy
means docker proxy is 8080 and SELinux is disabled. I checked.

Hmm. Perhaps I misunderstood the OP.

If curl http://localhost:8080/ doesn’t give you Discourse, then I’d say something is wrong with Discourse. Do you have any plugins installed?

No I have no plugins installed. I checked all logs of discourse carefully there are no errors and it is working on port 8080.

Does Discourse have force_https turned on and apache is trying to access http?

How do I check this? Is there any other config file for discourse?

If you can access forum on 8080 then log in as admin and check the admin setting called force https

It should be disabled to make it work on http

I just checked…Its disabled.

But you can currently access the site via port 8080. An earlier post has this link: http://forum.6figureswithchris.com:8080/ so Discourse is working

Do you have X-Forwarded-For IP chaining set up properly? If that’s broken, the “flooding protection” in the discourse-internal-NGINX will stop dropping connections (because all traffic is coming from a single IP).

1 Like

A post was split to a new topic: Multisite installation not available after rebuild

How do I check this, please? I checked some stackoverflow answers but couldnt understand how to check this…

Well, the mod_proxy documentation doesn’t suggest you can turn it off, actually: mod_proxy - Apache HTTP Server Version 2.4

Yeah its on. I checked with httpd -M in CentOS system this command tells what all modules are active.