nginx-proxy-manager icon indicating copy to clipboard operation
nginx-proxy-manager copied to clipboard

Initial login leads to "Bad Gateway"

Open MarcS1975 opened this issue 1 year ago • 17 comments

Describe the bug Initial login shows "Bad gateway" error

Nginx Proxy Manager Version 2.11.1

To Reproduce Steps to reproduce the behavior:

  1. launch latest Docker container -> works
  2. goto myIP:81/login
  3. use the initial creds
  4. Error on page: Bad gateway

Expected behavior Log into manager

Operating System Debian 9.13 on Host

Here is the error log:

14/03/2024
13:57:27
❯ Configuring npm user ...
14/03/2024
13:57:27
useradd warning: npm's uid 0 outside of the UID_MIN 1000 and UID_MAX 60000 range.
14/03/2024
13:57:27
❯ Configuring npm group ...
14/03/2024
13:57:27
❯ Checking paths ...
14/03/2024
13:57:27
❯ Setting ownership ...
14/03/2024
13:57:36
❯ Dynamic resolvers ...
14/03/2024
13:57:36
❯ IPv6 ...
14/03/2024
13:57:36
Enabling IPV6 in hosts in: /etc/nginx/conf.d
14/03/2024
13:57:36
- /etc/nginx/conf.d/default.conf
14/03/2024
13:57:36
- /etc/nginx/conf.d/include/block-exploits.conf
14/03/2024
13:57:36
- /etc/nginx/conf.d/include/ssl-ciphers.conf
14/03/2024
13:57:36
- /etc/nginx/conf.d/include/letsencrypt-acme-challenge.conf
14/03/2024
13:57:36
- /etc/nginx/conf.d/include/proxy.conf
14/03/2024
13:57:36
- /etc/nginx/conf.d/include/ip_ranges.conf
14/03/2024
13:57:36
- /etc/nginx/conf.d/include/force-ssl.conf
14/03/2024
13:57:36
- /etc/nginx/conf.d/include/assets.conf
14/03/2024
13:57:36
- /etc/nginx/conf.d/include/resolvers.conf
14/03/2024
13:57:36
- /etc/nginx/conf.d/production.conf
14/03/2024
13:57:36
Enabling IPV6 in hosts in: /data/nginx
14/03/2024
13:57:36
❯ Docker secrets ...
14/03/2024
13:57:36
14/03/2024
13:57:36
-------------------------------------
14/03/2024
13:57:36
 _   _ ____  __  __
14/03/2024
13:57:36
| \ | |  _ \|  \/  |
14/03/2024
13:57:36
|  \| | |_) | |\/| |
14/03/2024
13:57:36
| |\  |  __/| |  | |
14/03/2024
13:57:36
|_| \_|_|   |_|  |_|
14/03/2024
13:57:36
-------------------------------------
14/03/2024
13:57:36
User:  npm PUID:0 ID:0 GROUP:0
14/03/2024
13:57:36
Group: npm PGID:0 ID:0
14/03/2024
13:57:36
-------------------------------------
14/03/2024
13:57:36
14/03/2024
13:57:36
❯ Starting nginx ...
14/03/2024
13:57:36
❯ Starting backend ...
14/03/2024
13:57:36
14/03/2024
13:57:36
  #  node[161]: std::unique_ptr<long unsigned int> node::WorkerThreadsTaskRunner::DelayedTaskScheduler::Start() at ../src/node_platform.cc:68
14/03/2024
13:57:36
  #  Assertion failed: (0) == (uv_thread_create(t.get(), start_thread, this))
14/03/2024
13:57:36
14/03/2024
13:57:36
----- Native stack trace -----
14/03/2024
13:57:36
14/03/2024
13:57:36
 1: 0xca5580 node::Abort() [node]
14/03/2024
13:57:36
 2: 0xca5600 node::errors::SetPrepareStackTraceCallback(v8::FunctionCallbackInfo<v8::Value> const&) [node]
14/03/2024
13:57:36
 3: 0xd24949 node::WorkerThreadsTaskRunner::WorkerThreadsTaskRunner(int) [node]
14/03/2024
13:57:36
 4: 0xd24a6c node::NodePlatform::NodePlatform(int, v8::TracingController*, v8::PageAllocator*) [node]
14/03/2024
13:57:36
 5: 0xc5e5d3  [node]
14/03/2024
13:57:36
 6: 0xc5ef64 node::Start(int, char**) [node]
14/03/2024
13:57:36
 7: 0x7fee5d05224a  [/lib/x86_64-linux-gnu/libc.so.6]
14/03/2024
13:57:36
 8: 0x7fee5d052305 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
14/03/2024
13:57:36
 9: 0xbb8eee _start [node]
14/03/2024
13:57:36
./run: line 21:   161 Aborted                 (core dumped) s6-setuidgid "$PUID:$PGID" bash -c "export HOME=$NPMHOME;node --abort_on_uncaught_exception --max_old_space_size=250 index.js"
14/03/2024
13:57:37
❯ Starting backend ...
14/03/2024
13:57:37
14/03/2024
13:57:37
  #  node[182]: std::unique_ptr<long unsigned int> node::WorkerThreadsTaskRunner::DelayedTaskScheduler::Start() at ../src/node_platform.cc:68
14/03/2024
13:57:37
  #  Assertion failed: (0) == (uv_thread_create(t.get(), start_thread, this))
14/03/2024
13:57:37
14/03/2024
13:57:37
----- Native stack trace -----
14/03/2024
13:57:37
14/03/2024
13:57:37
 1: 0xca5580 node::Abort() [node]
14/03/2024
13:57:37
 2: 0xca5600 node::errors::SetPrepareStackTraceCallback(v8::FunctionCallbackInfo<v8::Value> const&) [node]
14/03/2024
13:57:37
 3: 0xd24949 node::WorkerThreadsTaskRunner::WorkerThreadsTaskRunner(int) [node]
14/03/2024
13:57:37
 4: 0xd24a6c node::NodePlatform::NodePlatform(int, v8::TracingController*, v8::PageAllocator*) [node]
14/03/2024
13:57:37
 5: 0xc5e5d3  [node]
14/03/2024
13:57:37
 7: 0x7f8eab65a24a  [/lib/x86_64-linux-gnu/libc.so.6]
14/03/2024
13:57:37
 8: 0x7f8eab65a305 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
14/03/2024
13:57:37
 9: 0xbb8eee _start [node]
14/03/2024
13:57:37
./run: line 21:   182 Aborted                 (core dumped) s6-setuidgid "$PUID:$PGID" bash -c "export HOME=$NPMHOME;node --abort_on_uncaught_exception --max_old_space_size=250 index.js"
14/03/2024
13:57:38
❯ Starting backend ...
14/03/2024
13:57:38
14/03/2024
13:57:38
  #  node[186]: std::unique_ptr<long unsigned int> node::WorkerThreadsTaskRunner::DelayedTaskScheduler::Start() at ../src/node_platform.cc:68
14/03/2024
13:57:38
  #  Assertion failed: (0) == (uv_thread_create(t.get(), start_thread, this))
14/03/2024
13:57:38
14/03/2024
13:57:38
----- Native stack trace -----
14/03/2024
13:57:38
14/03/2024
13:57:38
 1: 0xca5580 node::Abort() [node]
14/03/2024
13:57:38
 2: 0xca5600 node::errors::SetPrepareStackTraceCallback(v8::FunctionCallbackInfo<v8::Value> const&) [node]
14/03/2024
13:57:38
 3: 0xd24949 node::WorkerThreadsTaskRunner::WorkerThreadsTaskRunner(int) [node]
14/03/2024
13:57:38
 4: 0xd24a6c node::NodePlatform::NodePlatform(int, v8::TracingController*, v8::PageAllocator*) [node]
14/03/2024
13:57:38
 5: 0xc5e5d3  [node]
14/03/2024
13:57:38
 6: 0xc5ef64 node::Start(int, char**) [node]
14/03/2024
13:57:38
 7: 0x7fbf8030724a  [/lib/x86_64-linux-gnu/libc.so.6]
14/03/2024
13:57:38
 8: 0x7fbf80307305 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
14/03/2024
13:57:38
 9: 0xbb8eee _start [node]
14/03/2024
13:57:39
./run: line 21:   186 Aborted                 (core dumped) s6-setuidgid "$PUID:$PGID" bash -c "export HOME=$NPMHOME;node --abort_on_uncaught_exception --max_old_space_size=250 index.js"

MarcS1975 avatar Mar 14 '24 06:03 MarcS1975

using docker image 2.10.4 works fine

MarcS1975 avatar Mar 14 '24 06:03 MarcS1975

This appears to be an issue only with older versions of docker, possibly before 20.10.10

Update your Docker to fix this issue.

Ubunu official APT repo has outdated docker versions Follow the documentation to add the official docker repo which will allow you to upgrade to the latest version- eg. with Ubuntu: https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository

This has worked for me on Ubuntu

Alternatively - and a VERY BAD IDEA - is to remove security contraints in your container by adding this to your app config - at your own risk:

security_opt:
  - seccomp:unconfined

mrw5 avatar Mar 18 '24 06:03 mrw5

I am facing the same issue, i try to make the initial login and receive "Bad Gateway" I try version 2.11.1 and 2.10.4, I have docker v25.0.4

this is my current docker-compose.yml

version: "3"
services:
  npm-app:
    image: 'jc21/nginx-proxy-manager:2.10.4'
    container_name: npm-app
    restart: unless-stopped
    ports:
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '81:81' # Admin Web Port
      # Add any other Stream port you want to expose
      # - '21:21' # FTP
    environment:
      DB_MYSQL_HOST: "npm-db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "npm"
      DB_MYSQL_PASSWORD: "npm"
      DB_MYSQL_NAME: "npm"
      # Uncomment the line below if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - npm-db
    networks:
      - npm-nw
      - npm-internal

  npm-db:
    image: 'mariadb:latest'
    container_name: npm-db
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: 'npm'
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: 'npm'
      MYSQL_PASSWORD: 'npm'
    volumes:
      - ./data/mysql:/var/lib/mysql
    networks:
      - npm-internal

networks:
  npm-internal:
  npm-nw:
    external: true

ZahiriNatZuke avatar Mar 26 '24 03:03 ZahiriNatZuke

I am facing the same issue, i try to make the initial login and receive "Bad Gateway" I try version 2.11.1 and 2.10.4, I have docker v25.0.4

Can you check the container logs to see what the error is?

this command should dump the log for your container: docker logs npm-app

mrw5 avatar Mar 26 '24 04:03 mrw5

[3/26/2024] [4:30:35 AM] [Global   ] › ℹ  info      Using MySQL configuration
[3/26/2024] [4:30:36 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db
[3/26/2024] [4:30:37 AM] [Global   ] › ✖  error     connect ECONNREFUSED 192.168.112.2:3306
[3/26/2024] [4:30:38 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db
[3/26/2024] [4:30:39 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db
[3/26/2024] [4:30:40 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db
[3/26/2024] [4:30:42 AM] [Global   ] › ✖  error     connect ECONNREFUSED 192.168.112.2:3306
[3/26/2024] [4:30:43 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db
[3/26/2024] [4:30:44 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db
[3/26/2024] [4:30:45 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db
[3/26/2024] [4:30:46 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db
[3/26/2024] [4:30:47 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db
[3/26/2024] [4:30:48 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db
[3/26/2024] [4:30:49 AM] [Global   ] › ✖  error     connect ECONNREFUSED 192.168.112.2:3306
[3/26/2024] [4:30:50 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db
[3/26/2024] [4:30:51 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db
[3/26/2024] [4:30:52 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db
[3/26/2024] [4:30:53 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db
[3/26/2024] [4:30:54 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db
[3/26/2024] [4:30:55 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db
[3/26/2024] [4:30:56 AM] [Global   ] › ✖  error     getaddrinfo EAI_AGAIN npm-db

ZahiriNatZuke avatar Mar 26 '24 04:03 ZahiriNatZuke

Different issue than the original issue in this bug report, MariaDB is refusing connections, perhaps check logs for npm-db container to see if that provides more detail

mrw5 avatar Mar 26 '24 04:03 mrw5

I have the same issue when restarting docker. I need always to restart mariadb container after Nginx Proxy Manager and then it works

nunolu avatar Mar 26 '24 08:03 nunolu

Hi @mrw5, Here are the logs of the npm-db container

npm-db.log

ZahiriNatZuke avatar Mar 26 '24 12:03 ZahiriNatZuke

I don't have experience running Maria DB, but this error indicates an upgrade is needed, but auto upgrade is not enabled: MariaDB upgrade (...) required, but skipped due to $MARIADB_AUTO_UPGRADE setting

Try adding MARIADB_AUTO_UPGRADE: '1' into your environment variables in your compose file for the DB container and see if that helps

Outside of this, I'm really not sure. I run SQLite for this container

mrw5 avatar Mar 26 '24 13:03 mrw5

ok thanks @mrw5 , I'm going to try this thing you told me about. In any case, could you share an example using SQLite as you mentioned.

ZahiriNatZuke avatar Mar 26 '24 13:03 ZahiriNatZuke

I managed to solve the problem. I wiped my docker compose volumes, made some changes and got docker compose back up.

version: "3.8"
services:
  npm-app:
    image: 'jc21/nginx-proxy-manager:2.10.4'
    container_name: npm-app
    restart: unless-stopped
    ports:
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '81:81' # Admin Web Port
      # Add any other Stream port you want to expose
      - '21:21' # FTP
    environment:
      DB_MYSQL_HOST: "npm-db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "npm"
      DB_MYSQL_PASSWORD: "npm"
      DB_MYSQL_NAME: "npm"
      # Uncomment the line below if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      - ./nginx/data:/data
      - ./nginx/letsencrypt:/etc/letsencrypt
    depends_on:
      - npm-db

  npm-db:
    image: 'jc21/mariadb-aria:latest'
    container_name: npm-db
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: 'npm'
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: 'npm'
      MYSQL_PASSWORD: 'npm'
      MARIADB_AUTO_UPGRADE: '1'
    volumes:
      - ./mariadb:/var/lib/mysql

Thanks for everything @nunolu & @mrw5

ZahiriNatZuke avatar Mar 26 '24 13:03 ZahiriNatZuke

restarting maria_db fixed the issue.

0xab3d avatar Apr 13 '24 12:04 0xab3d

I managed to solve the problem. I wiped my docker compose volumes, made some changes and got docker compose back up.

version: "3.8"
services:
  npm-app:
    image: 'jc21/nginx-proxy-manager:2.10.4'
    container_name: npm-app
    restart: unless-stopped
    ports:
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '81:81' # Admin Web Port
      # Add any other Stream port you want to expose
      - '21:21' # FTP
    environment:
      DB_MYSQL_HOST: "npm-db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "npm"
      DB_MYSQL_PASSWORD: "npm"
      DB_MYSQL_NAME: "npm"
      # Uncomment the line below if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      - ./nginx/data:/data
      - ./nginx/letsencrypt:/etc/letsencrypt
    depends_on:
      - npm-db

  npm-db:
    image: 'jc21/mariadb-aria:latest'
    container_name: npm-db
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: 'npm'
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: 'npm'
      MYSQL_PASSWORD: 'npm'
      MARIADB_AUTO_UPGRADE: '1'
    volumes:
      - ./mariadb:/var/lib/mysql

Thanks for everything @nunolu & @mrw5

If using this configuration still results in a failure, you can try adding the following line under the npm-app options links:

  • npm-db

like this

version: "3.8"
services:
  npm-app:
    image: 'jc21/nginx-proxy-manager:latest'
    container_name: npm-app
    restart: unless-stopped
    ports:
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '81:81' # Admin Web Port
      # Add any other Stream port you want to expose
      - '21:21' # FTP
    environment:
      DB_MYSQL_HOST: "npm-db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "npm"
      DB_MYSQL_PASSWORD: "npm"
      DB_MYSQL_NAME: "npm"
      # Uncomment the line below if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - npm-db
    network_mode: bridge
    links:
      - npm-db

  npm-db:
    image: 'jc21/mariadb-aria:latest'
    container_name: npm-db
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: 'npm'
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: 'npm'
      MYSQL_PASSWORD: 'npm'
      MARIADB_AUTO_UPGRADE: '1'
    volumes:
      - ./mysql:/var/lib/mysql
    network_mode: bridge

hsoul avatar May 11 '24 05:05 hsoul

Had the same issue. I just rolled back to an older version. Ill try the solutions proposed here, but that's kinda weird the dev team didn't found a real solution to this

SlimGary avatar May 19 '24 22:05 SlimGary

Issue is now considered stale. If you want to keep it open, please comment :+1:

github-actions[bot] avatar Dec 29 '24 02:12 github-actions[bot]

This error seem to be related with Node's behavior

  #  Assertion failed: (0) == (uv_thread_create(t.get(), start_thread, this))

See https://github.com/nodejs/node/issues/53919#issuecomment-2628742164

docker

docker run --security-opt seccomp=unconfined yourhub/yourimage:version

docker-compose

security_opt:
    - seccomp=unconfined

Worked for me

More information about what seccomp=unconfined does: https://docs.docker.com/engine/security/seccomp/

It's not totally clear to me what security access nginx requires. Hope someone can take a look and consider adding this into the recommended docker configuration in setup instruction

hoiekim avatar Feb 23 '25 04:02 hoiekim

Issue is now considered stale. If you want to keep it open, please comment :+1:

github-actions[bot] avatar Nov 26 '25 02:11 github-actions[bot]