Fixing Gateway 502 Error
I have a home server that I'm setting up with pterodactyl and nginx proxy manager and I've successfully setup the host for nginx proxy manager but when I go to the domain for the panel that I've set up I get a gateway error and I don't know what the problem is can anyone help?
75 Replies
Anyone?
Your nginx server is probably returning that if you're not using cloudflare tunnels. I would check your nginx logs first/make sure it can reach the backend you specified, I assume you're using it as a reverse proxy to pterodactyl?
yes
so I can access the panel outside of my home network
Which logs should I check to make sure it reaches the backend?
2023/07/11 00:47:31 [emerg] 35678#35678: still could not bind()
2023/07/11 00:48:13 [emerg] 35834#35834: bind() to 0.0.0.0:80 failed (98: Unknown error)
2023/07/11 00:48:13 [emerg] 35834#35834: bind() to 0.0.0.0:80 failed (98: Unknown error)
2023/07/11 00:48:13 [emerg] 35834#35834: bind() to 0.0.0.0:80 failed (98: Unknown error)
2023/07/11 00:48:13 [emerg] 35834#35834: bind() to 0.0.0.0:80 failed (98: Unknown error)
2023/07/11 00:48:13 [emerg] 35834#35834: bind() to 0.0.0.0:80 failed (98: Unknown error)
2023/07/11 00:48:13 [emerg] 35834#35834: still could not bind()
2023/07/11 00:48:29 [emerg] 35891#35891: bind() to 0.0.0.0:80 failed (98: Unknown error)
2023/07/11 00:48:29 [emerg] 35891#35891: bind() to 0.0.0.0:80 failed (98: Unknown error)
2023/07/11 00:48:29 [emerg] 35891#35891: bind() to 0.0.0.0:80 failed (98: Unknown error)
2023/07/11 00:48:29 [emerg] 35891#35891: bind() to 0.0.0.0:80 failed (98: Unknown error)
2023/07/11 00:48:29 [emerg] 35891#35891: bind() to 0.0.0.0:80 failed (98: Unknown error)
This is error.log.1
nginx error logs, I have no experience using nginx proxy manager, so no clue where the default location for them with that is
But I'm not sure if this was an error I had before or the same one
Sorry I mean or this one
looks like something is already using port 80, or something else is wrong with your config/setup
Nginx Proxy manager uses port 80 so i dont think its that so Ill go over my config
I had the same error not by using pterodactyl and also not with the same errors but I fixed it by changing the host to 0.0.0.0
(Which couldnt be secure if theres no Content-Security-Policy or so
Wdym change the host to 0.0.0.0
nvmd im dumb lol
Just try another port
I just the 49152 Ports upwards
They are unassigned ports
You just have to proxy them two times.
one time with nginx and one time with cloudflare (if required)
But isn’t nginx supposed to run on ports 80,81,443
Yes nginx is running on 80 and your server like http or node server is running on the 49152 port
It is a node web server right?
That's my configuration but idk if it would work with pterodactyl
hmm i have listen on 80
that may be the issue
It's a personal server that I bought and is in my house
If the pterodactly is listening on 80 and nginx also then yes
but nginx is supposed to be listening on 80
I dont really recommend it <:Panda_think:895298577872605184>
my thing uses https so shouldnt i use 443 instead of 80
Can make very much issues and cloudflare wouldnt help you then with their DDoS protection
I already had it and before I only used it to host minecraft servers but now I want to set up a proxy and use it for other things
Ah okay if its just for private use then its okay
well#
its not really
but its not for large scale use
If I have the cloudflare proxy setup shouldn't it already be DDOS protected?
Even if the DDoS protection that Cloudflare issues wouldnt be usefull. Becaue if someone have access to your pterodactyl and uploads a "bot" or so with a code that sends him your private IP adress then you can say bye to your Internet Network
Ah I see
Yea, a (already termed) partned of mine had that issue and yea <:gx_heh:919545549865230368>
It was kinda funny to watch him x3
rip
still want to get the proxy working though
Yea. does it works now or not
i dont think that was the issue
theyre not listening on the same port
Linux server or windows?
Linux server
netstat -anpe | grep "80" | grep "LISTEN"
try this
And then prob. kill the process pid
I need to install net tools
one sec
A life without net-tools is a hard life
lol
this is what comes up
Do you want me to run it again in root?
try these commands:
sudo kill 83051
sudo kill 80800
Then the processes should be stopped and then try again
thats weird
It says no such process
Try to restart the server
its rebooting
Prob. a ghost process. A process that is running but not really in use or accessible
I see
Also is a gateway error usually an issue with the ports?
There can be a lot errors
THe gateway error is issued by your Webserver aka nginx
Im back in
ok a lot of things have gone away
nice
This could also be because the proxy isn't actually running yet
looks okay
Each time I reboot I need to manually start docker compose
just try to start nginx and then pterodactyl
All of that is running on docker?
yes
ohhh with docker I cant really help you
ah
Can you access pterodactyl from your computer via the ip
Before I couldn't
Because nginx was using port 80
okay
but the problem now is im not on my home network
Are you using cloudflared or open ports?
both
wait
you mean to access the server terminal
for that I'm using open ports
okay
And it still not working right?
one sec
Again I can access nginx proxy manager but I'm still getting the gateway 502 error
hm
are there any errors you get?
Is there a way I can test what part of the gateway is the problem
on the terminal?
no
also I haven't completely finished the pterodactyl installation
I am only onto the point where you install wings
which is where I started seeing the problem
strange
https://www.youtube.com/watch?v=cbr8tddvAWw I've been using this video and it was all working until he opened his panel and it worked but mine didnt
lilciv
YouTube
Installing Pterodactyl Panel and Wings Behind Nginx Proxy Manager a...
**Reupload due to audio issues, sorry!
Here we'll install the Pterodactyl Panel and Wings while securing the panel behind Nginx Proxy Manager and Cloudflare
TIMESTAMPS
0:00 Intro and Prerequisites
2:30 Installing the Panel
6:05 Nginx Web Server Setup + Self-Signed Cert
9:25 Wings Setup
12:20 Nginx Proxy Manager Config
13:25 Adding the Wings No...
Is it possible you get with him into contact via dc or so?
I can try let me check
There doesn't seem to be
but it seems he's still actively reading comments so maybe I'll leave one
I've left a comment but while doing that I read a section of the description that said this
Could this possibly be what's been causing the issue?
Yes
You can create a origin Certificate
I'm using a wildcard certificate
ah okay
Hi there, can I ask here too? I have same problem, sometimes my web send the notice 502 bad gateway, and i have check about error.log. Here is the error log from var/log/nginx/error.log:
2023/07/11 01:28:02 [error] 877351#877351: *491040 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: [IP XXX.XXX.XXX.XXX], server: mydomain.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "mydomain.com"
anyone known that issue and how to fix this ?
Use php8.+ Php7.4 isn't supported anymore as far I know