NginxProxyManager / nginx-proxy-manager

Docker container for managing Nginx proxy hosts with a simple, powerful interface
https://nginxproxymanager.com
MIT License
22.6k stars 2.62k forks source link

Bad Gateway on login attempt #310

Closed adman120 closed 4 years ago

adman120 commented 4 years ago

On container launch via the recommended compose file, I am unable to get past the login screen as it tells me I have a bad gateway every time I try and log in.

silkyclouds commented 9 months ago

Same problem here. I already got it but can't remember how I fixed it...

nginx updated last night, here is what I can see in the logs :

2024/01/20 08:35:30 [error] 185#185: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.3.6, server: nginxproxymanager, request: "POST /api/tokens HTTP/1.1", upstream: "http://127.0.0.1:3000/tokens", host: "192.168.3.19:81", referrer: "http://192.168.3.19:81/login"

On the other hand, npm starts and redirects the traffic as it should. I can reach all my web services.

I've recovered backups, same thing. - bad gateway at login screen.

I'm NOT using any separate database to run npm butthe integrated sqlite DB :

❯ Starting nginx ...
❯ Starting backend ...
[1/20/2024] [8:34:59 AM] [Global   ] › ℹ  info      Using Sqlite: /data/database.sqlite
[1/20/2024] [8:35:02 AM] [Migrate  ] › ℹ  info      Current database version: none

I will try to go back to previous version to see if it helps... but this problem happening from time to time makes me lesser confident in npm and I think I'm just gonna move to Traefik.

goppinath commented 9 months ago

I am also using SQLite and getting the same error as @silkyclouds saying Bad Gateway. I have reverted to the image jc21/nginx-proxy-manager:2.10.4 and I can log in again.

silkyclouds commented 9 months ago

I am also using SQLite and getting the same error as @silkyclouds saying Bad Gateway. I have reverted to the image jc21/nginx-proxy-manager:2.10.4 and I can log in again.

Well I guess a downgrade is the only thing to go for, for now... Thanks for letting us know a downgrade worked for you !

silkyclouds commented 9 months ago

so I did downgrade to 2.10.4 as you recommended @goppinath but unfortunately I'm still geting bad gateway at login.

and I also have some env variable issue now as I can see the backend is not starting at all and logs loops on this :

❯ Starting backend ...
node: --openssl-legacy-provider is not allowed in NODE_OPTIONS
❯ Starting backend ...
node: --openssl-legacy-provider is not allowed in NODE_OPTIONS
skatespeare commented 9 months ago

so I did downgrade to 2.10.4 as you recommended @goppinath but unfortunately I'm still geting bad gateway at login.

and I also have some env variable issue now as I can see the backend is not starting at all and logs loops on this :

❯ Starting backend ...
node: --openssl-legacy-provider is not allowed in NODE_OPTIONS
❯ Starting backend ...
node: --openssl-legacy-provider is not allowed in NODE_OPTIONS

Removing the node_options from the env variables did the trick for me. Not sure if it broke anything else, but Let's Encrypt still works.

goppinath commented 9 months ago

@silkyclouds I have two NPM instances one on Debian 12 as a VPS and the other on the Raspberry Pi OS based on Debian 12. The VPS one gave the issue and the RPi one is running without any issue. Maybe try downgrading one more version as a workaround. I am seriously thinking of switching to a more stable reverse proxy manager and/or making the weekly incremental backup too.

goppinath commented 9 months ago

Thank you @jc21 I have updated to version 2.11.1 which was released just an hour ago and this has resolved my issue. @silkyclouds @skatespeare Give it a try. Let's appreciate the developers and support the project.

silkyclouds commented 9 months ago

@silkyclouds I have two NPM instances one on Debian 12 as a VPS and the other on the Raspberry Pi OS based on Debian 12. The VPS one gave the issue and the RPi one is running without any issue. Maybe try downgrading one more version as a workaround. I am seriously thinking of switching to a more stable reverse proxy manager and/or making the weekly incremental backup too.

well, I also have two broken instances (one running in a datacenter, under Debian vs. The one I just fixed using @skatespeare workaround (downgrading + removing the env. variable that refers to the legacy provider.

Now I just need to get the debian one running, but the same trick doesn't seem to help at all, it ain't starting anymore. :)

By the way, you could use the docker backup script I wrote if you plan to backup your docker containers ;)

silkyclouds commented 9 months ago

Thank you @jc21 I have updated to version 2.11.1 which was released just an hour ago and this has resolved my issue. @silkyclouds @skatespeare Give it a try. Let's appreciate the developers and support the project.

Nope, as soon I pull the latest again, I now have a lot of other cert renewal issues. I guess it's because I removed the legacy thing...

andreaswilli commented 9 months ago

Just encountered this issue with version 2.11.0. Upgrading to 2.11.1 fixed the issue for me.

DominikRoB commented 1 month ago

Encountered this error message as well after months of running without changes to any config or file. But a quick compose down. compose up fixed it.

MarkRotNF commented 1 month ago

I also had an gateway error.

docker ps showed that " nginxproxymanager-db-1" (jc21/mariadb-aria:latest) ist "restarting" (in loop).

docker-compose up (without -d) returned:

app-1  | ❯ Starting backend ...
app-1  | ❯ Starting nginx ...
db-1   | 2024-09-08 10:59:54 0 [Note] Starting MariaDB 10.11.5-MariaDB source revision 7875294b6b74b53dd3aaa723e6cc103d2bb47b2c as process 1
db-1   | Cannot find checkpoint record at LSN (1,0x361f80)
db-1   | 2024-09-08 10:59:54 0 [ERROR] mysqld: Aria recovery failed. Please run aria_chk -r on all Aria tables (*.MAI) and delete all aria_log.######## files
db-1   | 2024-09-08 10:59:54 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
db-1   | 2024-09-08 10:59:54 0 [Note] Plugin 'InnoDB' is disabled.
db-1   | 2024-09-08 10:59:54 0 [Note] Plugin 'FEEDBACK' is disabled.
db-1   | 2024-09-08 10:59:54 0 [ERROR] Could not open mysql.plugin table: "Unknown storage engine 'Aria'". Some plugins may be not loaded
db-1   | 2024-09-08 10:59:54 0 [ERROR] Failed to initialize plugins.

I was able to fix it with the following: cd to the mysql folder (should be the path thats in the docker-compose.yaml "db:" -> "volumes:". E.g. "./mysql" as in my case. image

docker-compose down sudo mv aria_log. XXXXXXXXX bak.aria_log.XXXXXXXXX docker-compose up -d (similar to described here: https://serverfault.com/questions/893626/mysql-wont-start-mysqld-got-signal-11)

(I'm not sure if this was due to insufficient free storage space. Mine was almost full.)

jqknono commented 3 weeks ago

The Fetching https://ip-ranges.amazonaws.com/ip-ranges.json blocked at startup. Some times this will cost many time.

If you're blocked by this fetching too, just run:

NPM_CTR_NAME=nginxproxymanager
docker exec $NPM_CTR_NAME sed -i 's/\.then(internalIpRanges\.fetch)//g' /app/index.js
docker restart $NPM_CTR_NAME

This should skip the fetching of the startup.