mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-25 09:25:55 +03:00
[GH-ISSUE #300] Unable to login - /api/tokens returns Bad Gateway #263
Labels
No labels
awaiting feedback
bug
cannot reproduce
dns provider request
duplicate
enhancement
enhancement
enhancement
good first issue
help wanted
invalid
need more info
no certbot plugin available
product-support
pull-request
question
stale
troll
upstream issue
v2
v2
v2
v3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-proxy-manager-NginxProxyManager#263
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @thjendk on GitHub (Feb 21, 2020).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/300
Describe the bug
After setting up the docker container, I am able to access the login page on port 81. However, when trying to login, the /api/token throws a bad request, and makes me unable to login.
I have tried to recreate the container, but with no effect.
To Reproduce
Steps to reproduce the behavior:
Screenshots

Operating System
Ubuntu 18.04
@thjendk commented on GitHub (Feb 21, 2020):
It looks like the issue might be down to an authentication error on the database.
The docker container for the nginx proxy manager throws the following error:
[2/21/2020] [12:24:21 PM] [Global ] › ✖ error connect ECONNREFUSED 172.20.0.2:3306How is this fixable?
@jc21 commented on GitHub (Feb 21, 2020):
Depends on how you’ve set up your deployment. Paste your docker compose file if you can.
@thjendk commented on GitHub (Feb 21, 2020):
The docker-compose file is identical to the example:
I have placed the files under /home/user/apps/nginx. Is it possible that the relative path mapping of the docker-compose file somehow prevents it from finding the correct configuration?
@jc21 commented on GitHub (Feb 21, 2020):
Ok cool so the config file should have the host set to “db”. If so and still not working, maybe the logs of the db container have a clue
@thjendk commented on GitHub (Feb 21, 2020):
Contents of config.json, located in the same folder as docker-compose:
Docker logs from db container:
@thjendk commented on GitHub (Feb 21, 2020):
I have fixed it by deploying the database on its own like this (from a clean install, remember to delete both the letsencrypt and the data folder):
docker-compose up -d dbWhen that is done, the package works, and can be deployed using the full docker-compose file again. I'm not sure what's causing it, but it might only be replicateable on a new system. I have been able to replicate it on Mac and two seperate linux VMs.
@toomastamm commented on GitHub (Feb 21, 2020):
How long did you wait after using the first docker-compose -d and then trying to login? The app takes a few minutes to get ready.
@thjendk commented on GitHub (Feb 23, 2020):
Like 15 minutes I think. The issue might have resolved itself if I had waited longer. Closing for now.
@jc21 commented on GitHub (Feb 23, 2020):
That's very strange. The NPM nodejs backend will check for db access every 15 seconds and it loops forever. Having the database container take up to 15 mins to be ready is way too long as well.
In my CI, it spins up a fresh stack every time and it has no problems spinning up a mariadb docker container within 1 minute.
@thjendk commented on GitHub (Feb 24, 2020):
I agree it’s way too long. Based on this comment: https://github.com/jc21/nginx-proxy-manager/issues/300#issuecomment-589635615 the mariaDb is ready, but is refusing connections: https://github.com/jc21/nginx-proxy-manager/issues/300#issuecomment-589632366
@Kinark commented on GitHub (Mar 9, 2020):
I'm having the same issue here.
Checked the data/logs/error.log and this error gets repeated over and over again:
2020/03/09 07:05:51 [error] 222#222: *42 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: nginxproxymanager, request: "GET /api/ HTTP/1 .1", upstream: "http://127.0.0.1:3000/", host: "127.0.0.1:81"@Kinark commented on GitHub (Mar 9, 2020):
And the docker for nginx container throws the following error:
[3/9/2020] [7:28:44 AM] [Global ] › ✖ error connect EHOSTUNREACH 172.20.0.2:330@jc21 commented on GitHub (Mar 9, 2020):
@Kinark your first comment relates to nginx processing upstream hosts, which is not the topic of this issue and is most likely a misconfigured host.
Your second comment is more applicable, but to be sure everything is ok, is the port in your config
330or3306?@delacosta456 commented on GitHub (Oct 6, 2020):
hi all
i was also having this issue and reading some issues (this too didn't help) but bellow is what definitely worked:
So WORKAROUND on my ubuntu, step by step :
(from the npm folder where config and yaml file are ) in terminal i run : sudo docker-compose down
then sudo kill -9
sudo lsof -t -i:81or sudo kill -9 $(sudo lsof -t -i:9001)now sudo docker-compose up -d
IMPORTANT STEP wait for at least 10 to 15 seconds before refreshing you browser on http://127.0.0.1:81
hope this will help (sorry for my English i'am french)