[GH-ISSUE #384] Bad Gateway #327

Closed
opened 2026-02-26 06:32:17 +03:00 by kerem · 2 comments
Owner

Originally created by @NeoAtomic83 on GitHub (Apr 23, 2020).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/384

After trying many different solutions It is time to open a ticket here.
I'am trying to use proxy manager and after an hour I am still not able to login into the nginx-proxy-manager. I am getting the bad gateway message.

Configuration: https://pastebin.com/vjtvVZ0w
Docker info: https://pastebin.com/9H97wBGZ

I'm trying to get it running on CentOS 8

What the problems looks like is that the nginx reverse proxy manager cannot acces the database
[4/23/2020] [3:02:34 PM] [Global ] › ✖ error connect EHOSTUNREACH 172.18.0.2:3306
[4/23/2020] [3:02:36 PM] [Global ] › ✖ error connect EHOSTUNREACH 172.18.0.2:3306
[4/23/2020] [3:02:38 PM] [Global ] › ✖ error connect EHOSTUNREACH 172.18.0.2:3306
[4/23/2020] [3:02:40 PM] [Global ] › ✖ error connect EHOSTUNREACH 172.18.0.2:3306

When I try this from the Docker host with mysql I can connect and see the databases. When I try to nc -vc db:3306 I get an host unreachable but I am able to ping db and receive a response.

Can someone point my to the right directions?

I have read all the topics regarding the bad gateway already and none of them solved the problem for me.

  • Tried changing the database
  • different credentials
  • Default settings
  • Rebuild everything
  • Prune the network settings
Originally created by @NeoAtomic83 on GitHub (Apr 23, 2020). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/384 After trying many different solutions It is time to open a ticket here. I'am trying to use proxy manager and after an hour I am still not able to login into the nginx-proxy-manager. I am getting the bad gateway message. Configuration: https://pastebin.com/vjtvVZ0w Docker info: https://pastebin.com/9H97wBGZ I'm trying to get it running on CentOS 8 What the problems looks like is that the nginx reverse proxy manager cannot acces the database [4/23/2020] [3:02:34 PM] [Global ] › ✖ error connect EHOSTUNREACH 172.18.0.2:3306 [4/23/2020] [3:02:36 PM] [Global ] › ✖ error connect EHOSTUNREACH 172.18.0.2:3306 [4/23/2020] [3:02:38 PM] [Global ] › ✖ error connect EHOSTUNREACH 172.18.0.2:3306 [4/23/2020] [3:02:40 PM] [Global ] › ✖ error connect EHOSTUNREACH 172.18.0.2:3306 When I try this from the Docker host with mysql I can connect and see the databases. When I try to nc -vc db:3306 I get an host unreachable but I am able to ping db and receive a response. Can someone point my to the right directions? I have read all the topics regarding the bad gateway already and none of them solved the problem for me. - Tried changing the database - different credentials - Default settings - Rebuild everything - Prune the network settings
kerem closed this issue 2026-02-26 06:32:17 +03:00
Author
Owner

@ronron555 commented on GitHub (Apr 23, 2020):

Same error here

<!-- gh-comment-id:618561968 --> @ronron555 commented on GitHub (Apr 23, 2020): Same error here
Author
Owner

@NeoAtomic83 commented on GitHub (Apr 23, 2020):

Masquerading allows for docker ingress and egress (this is the juicy bit)

firewall-cmd --zone=public --add-masquerade --permanent
firewall-cmd --permanent --zone=public --add-rich-rule='rule family=ipv4 source address=172.18.0.0/16 accept'

Specifically allow incoming traffic on port 80/443 (nothing new here)

firewall-cmd --zone=public --add-port=80/tcp
firewall-cmd --zone=public --add-port=443/tcp
firewall-cmd --zone=public --add-port=3306/tcp

Reload firewall to apply permanent rules

firewall-cmd --reload

And a reboot to restart dockerd did the trick for me.

Sources:
https://forums.docker.com/t/no-route-to-host-network-request-from-container-to-host-ip-port-published-from-other-container/39063/12
https://serverfault.com/questions/987686/no-network-connectivity-to-from-docker-ce-container-on-centos-8

<!-- gh-comment-id:618663892 --> @NeoAtomic83 commented on GitHub (Apr 23, 2020): # Masquerading allows for docker ingress and egress (this is the juicy bit) firewall-cmd --zone=public --add-masquerade --permanent firewall-cmd --permanent --zone=public --add-rich-rule='rule family=ipv4 source address=172.18.0.0/16 accept' # Specifically allow incoming traffic on port 80/443 (nothing new here) firewall-cmd --zone=public --add-port=80/tcp firewall-cmd --zone=public --add-port=443/tcp firewall-cmd --zone=public --add-port=3306/tcp # Reload firewall to apply permanent rules firewall-cmd --reload And a reboot to restart dockerd did the trick for me. Sources: https://forums.docker.com/t/no-route-to-host-network-request-from-container-to-host-ip-port-published-from-other-container/39063/12 https://serverfault.com/questions/987686/no-network-connectivity-to-from-docker-ce-container-on-centos-8
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#327
No description provided.