[GH-ISSUE #1098] bad gateway Login to your account #906

Closed
opened 2026-02-26 06:34:52 +03:00 by kerem · 19 comments
Owner

Originally created by @salgari on GitHub (May 15, 2021).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1098

hola, he instalado mariadb configurado en configuration.yaml (recorder:
db_url: mysql://homeassistant:password@core-mariadb/homeassistant?charset=utf8mb4, he abierto los puertor 80 y 443, he instalado ngnix, pero cuando intento ingresar me da error error bad gateway, ¿alguna solución?, gracias
Captura

Originally created by @salgari on GitHub (May 15, 2021). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1098 hola, he instalado mariadb configurado en configuration.yaml (recorder: db_url: mysql://homeassistant:password@core-mariadb/homeassistant?charset=utf8mb4, he abierto los puertor 80 y 443, he instalado ngnix, pero cuando intento ingresar me da error error bad gateway, ¿alguna solución?, gracias ![Captura](https://user-images.githubusercontent.com/17797695/118348699-64e80000-b54c-11eb-99d3-dc83601494c9.JPG)
kerem 2026-02-26 06:34:52 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@salgari commented on GitHub (May 15, 2021):

o se esto ayuda

2021/05/15 07:25:23 [error] 574#574: *3588 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.226, server: nginxproxymanager, request: "GET /api/ HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "192.168.1.226:81", referrer: "http://192.168.1.226:81/"

<!-- gh-comment-id:841604006 --> @salgari commented on GitHub (May 15, 2021): o se esto ayuda 2021/05/15 07:25:23 [error] 574#574: *3588 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.226, server: nginxproxymanager, request: "GET /api/ HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "192.168.1.226:81", referrer: "http://192.168.1.226:81/"
Author
Owner

@netstx commented on GitHub (May 21, 2021):

I have the same issue after upgrading to 2.9.3, looked at the logs, but haven't figured it out yet

<!-- gh-comment-id:845592096 --> @netstx commented on GitHub (May 21, 2021): I have the same issue after upgrading to 2.9.3, looked at the logs, but haven't figured it out yet
Author
Owner

@salgari commented on GitHub (May 21, 2021):

. I have enabled on the router nat loopback. Thanks

El vie., 21 may. 2021 3:43, Rafael @.***> escribió:

I have the same issue after upgrading to 2.9.3, looked at the logs, but
haven't figured it out yet


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/jc21/nginx-proxy-manager/issues/1098#issuecomment-845592096,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AEHZEP4IOFIYQW7ETYMOLOLTOW3FZANCNFSM445QMAEQ
.

<!-- gh-comment-id:845642101 --> @salgari commented on GitHub (May 21, 2021): . I have enabled on the router nat loopback. Thanks El vie., 21 may. 2021 3:43, Rafael ***@***.***> escribió: > I have the same issue after upgrading to 2.9.3, looked at the logs, but > haven't figured it out yet > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/jc21/nginx-proxy-manager/issues/1098#issuecomment-845592096>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AEHZEP4IOFIYQW7ETYMOLOLTOW3FZANCNFSM445QMAEQ> > . >
Author
Owner

@jc21 commented on GitHub (May 21, 2021):

docker logs name_of_npm_container
and look for obvious problems.

<!-- gh-comment-id:845666752 --> @jc21 commented on GitHub (May 21, 2021): `docker logs name_of_npm_container` and look for obvious problems.
Author
Owner

@netstx commented on GitHub (May 21, 2021):

@jc21 i'm running npm on a alpine linux LXC container (inside proxmox), I was digging on /var/log, but didn't find anything. have you seen this error before?

<!-- gh-comment-id:845932728 --> @netstx commented on GitHub (May 21, 2021): @jc21 i'm running npm on a alpine linux LXC container (inside proxmox), I was digging on /var/log, but didn't find anything. have you seen this error before?
Author
Owner

@salgari commented on GitHub (May 21, 2021):

I'm sorry, I don't know what it can be

El vie., 21 may. 2021 14:59, Rafael @.***> escribió:

@jc21 https://github.com/jc21 i'm running npm on a alpine linux LXC
container (inside proxmox), I was digging on /var/log, but didn't find
anything. have you seen this error before?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/jc21/nginx-proxy-manager/issues/1098#issuecomment-845932728,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AEHZEP6WHHMSF34ABWU6FFDTOZKL3ANCNFSM445QMAEQ
.

<!-- gh-comment-id:846108447 --> @salgari commented on GitHub (May 21, 2021): I'm sorry, I don't know what it can be El vie., 21 may. 2021 14:59, Rafael ***@***.***> escribió: > @jc21 <https://github.com/jc21> i'm running npm on a alpine linux LXC > container (inside proxmox), I was digging on /var/log, but didn't find > anything. have you seen this error before? > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/jc21/nginx-proxy-manager/issues/1098#issuecomment-845932728>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AEHZEP6WHHMSF34ABWU6FFDTOZKL3ANCNFSM445QMAEQ> > . >
Author
Owner

@VeteraNovis commented on GitHub (May 28, 2021):

I'm having the same issue. It seems to be a problem connecting to the database

error getaddrinfo ENOTFOUND db

<!-- gh-comment-id:850334435 --> @VeteraNovis commented on GitHub (May 28, 2021): I'm having the same issue. It seems to be a problem connecting to the database `error getaddrinfo ENOTFOUND db`
Author
Owner

@NyxcAdmin commented on GitHub (Jun 4, 2021):

@Callum-W Exact same issue here. Any luck on your end?

When I visit jc21/nginx-proxy-manager:latest in the browser on port 81, I see "Bad Gateway" when attempting to login via admin. My log returns the same error you mentioned.

version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: always
    ports:
      # Public HTTP Port:
      - '80:80'
      # Public HTTPS Port:
      - '443:443'
      # Admin Web Port:
      - '81:81'
      # Add any other Stream port you want to expose
      # - '21:21' # FTP
    environment:
      DISABLE_IPV6: 'true'
      # These are the settings to access your db
      # If you would rather use Sqlite uncomment this
      # and remove all DB_MYSQL_* lines above
      # DB_SQLITE_FILE: "/data/database.sqlite"
      # Uncomment this if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      - ./Users/brittanysalas/.config/production.json
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - db
  db:
    image: 'webhippie/mariadb:latest'
    restart: always
    environment:
      MARIADB_ROOT_PASSWORD: 'npm'
      MARIADB_DATABASE: 'npm'
      MARIADB_USERNAME: 'npm'
      MARIADB_PASSWORD: 'npm'
    volumes:
      - ./data/mysql:/var/lib/mysql

I am on a MacOS with the latest update. I am a noob and cannot describe my environment in further detail.

<!-- gh-comment-id:855101974 --> @NyxcAdmin commented on GitHub (Jun 4, 2021): @Callum-W Exact same issue here. Any luck on your end? When I visit jc21/nginx-proxy-manager:latest in the browser on port 81, I see "Bad Gateway" when attempting to login via admin. My log returns the same error you mentioned. ``` version: '3' services: app: image: 'jc21/nginx-proxy-manager:latest' restart: always ports: # Public HTTP Port: - '80:80' # Public HTTPS Port: - '443:443' # Admin Web Port: - '81:81' # Add any other Stream port you want to expose # - '21:21' # FTP environment: DISABLE_IPV6: 'true' # These are the settings to access your db # If you would rather use Sqlite uncomment this # and remove all DB_MYSQL_* lines above # DB_SQLITE_FILE: "/data/database.sqlite" # Uncomment this if IPv6 is not enabled on your host # DISABLE_IPV6: 'true' volumes: - ./Users/brittanysalas/.config/production.json - ./data:/data - ./letsencrypt:/etc/letsencrypt depends_on: - db db: image: 'webhippie/mariadb:latest' restart: always environment: MARIADB_ROOT_PASSWORD: 'npm' MARIADB_DATABASE: 'npm' MARIADB_USERNAME: 'npm' MARIADB_PASSWORD: 'npm' volumes: - ./data/mysql:/var/lib/mysql ``` I am on a MacOS with the latest update. I am a noob and cannot describe my environment in further detail.
Author
Owner

@NathanPeake commented on GitHub (Jun 6, 2021):

fresh install and same issue

<!-- gh-comment-id:855480960 --> @NathanPeake commented on GitHub (Jun 6, 2021): fresh install and same issue
Author
Owner

@NathanPeake commented on GitHub (Jun 7, 2021):

ok so I have tried multiple versions and have the same error, so I dont think its to do with this version and more to do with the db

<!-- gh-comment-id:855498859 --> @NathanPeake commented on GitHub (Jun 7, 2021): ok so I have tried multiple versions and have the same error, so I dont think its to do with this version and more to do with the db
Author
Owner

@StevenJonSmith commented on GitHub (Jun 9, 2021):

I too am having this issue

<!-- gh-comment-id:858102138 --> @StevenJonSmith commented on GitHub (Jun 9, 2021): I too am having this issue
Author
Owner

@VeteraNovis commented on GitHub (Jun 12, 2021):

I made no progress and ended up moving to Traefik2 instead as my reverse proxy. It seemed much more complicated but I seem to have got it working in the end. I followed this guide for anyone interested. No matter what I tried I just couldn't get this working, either with jlsage or jc21.

<!-- gh-comment-id:860001232 --> @VeteraNovis commented on GitHub (Jun 12, 2021): I made no progress and ended up moving to Traefik2 instead as my reverse proxy. It seemed much more complicated but I seem to have got it working in the end. I followed [this guide](https://www.smarthomebeginner.com/traefik-2-docker-tutorial/#Prep_Work_for_Traefik_2) for anyone interested. No matter what I tried I just couldn't get this working, either with jlsage or jc21.
Author
Owner

@just-refresh commented on GitHub (Jun 28, 2021):

Run in the same issue.

Fix for me:
docker logs container_name - saw that the DB Connection failed, because of wrong Username and Password. Put them in a config.json.
And before running it again remove all images:
docker volume prune

Hope that helps someone.

<!-- gh-comment-id:869958815 --> @just-refresh commented on GitHub (Jun 28, 2021): ### Run in the same issue. **Fix for me:** `docker logs container_name` - saw that the DB Connection failed, because of wrong Username and Password. Put them in a config.json. And before running it again remove all images: `docker volume prune` Hope that helps someone.
Author
Owner

@cameronetchart commented on GitHub (Jul 12, 2021):

Are you using Docker Compose v2? According to the last post of #1057, this appears to cause this issue. I'm currently trying to figure out how to fix it using v2 (because I use Portainer on arm, and that Portainer still doesn't support v3 sadly).

<!-- gh-comment-id:878361429 --> @cameronetchart commented on GitHub (Jul 12, 2021): Are you using Docker Compose v2? According to the last post of #1057, this appears to cause this issue. I'm currently trying to figure out how to fix it using v2 (because I use Portainer on arm, and that Portainer still doesn't support v3 sadly).
Author
Owner

@simeonradivoev commented on GitHub (Sep 22, 2021):

For me, it was because the environmental variables didn't have the database port DB_MYSQL_PORT: 3306

<!-- gh-comment-id:924884374 --> @simeonradivoev commented on GitHub (Sep 22, 2021): For me, it was because the environmental variables didn't have the database port `DB_MYSQL_PORT: 3306`
Author
Owner

@UbioZur commented on GitHub (Oct 27, 2021):

Same problem here.
Linux Debian 11 5.10.0-9-amd64
Docker version 20.10.10, build b485636
docker-compose version 1.25.0, build unknown

NPM docker-compose file

npm-open:
        container_name: npm-open
        image: 'jc21/nginx-proxy-manager:latest'
        restart: unless-stopped
        networks:
            proxy:
                ipv4_address: 172.42.0.3
        hostname: npm-open
        ports:
          - '80:80'
          - '81:81'
          - '443:443'
        volumes:
          - /etc/localtime:/etc/localtime:ro
          - /etc/timezone:/etc/timezone:ro
          - ${HOME}/internal/npm/data:/data
          - ${HOME}/internal/letsencrypt:/etc/letsencrypt
        environment:
          - DB_MYSQL_HOST="mariadb"
          - DB_MYSQL_PORT=3306
          - DB_MYSQL_USER="npm"
          - DB_MYSQL_PASSWORD="CHANGEMEDBPASS"
          - DB_MYSQL_NAME="npm"
          - PUID=1000
          - PGID=1000
        labels:
            - com.centurylinklabs.watchtower.monitor-only

DATABASE docker-compose file

mariadb:
        container_name: mariadb
        image: "mariadb:10.6.4"
        restart: unless-stopped
        networks:
            proxy:
                ipv4_address: 172.42.0.60
        hostname: mariadb
        volumes:
            - /etc/localtime:/etc/localtime:ro
            - /etc/timezone:/etc/timezone:ro
            - ${HOME}/internal/mariadb/mysql:/var/lib/mysql
            - ${HOME}/logs/mariadb:/var/lib/mysql/logs
        environment:
            - PUID=1000
            - PGID=1000
        labels:
            - com.centurylinklabs.watchtower.enable="false"
        # Fix DB error with mariaDB 10.6.0 https://github.com/nextcloud/docker/issues/1492
        command: --innodb-read-only-compressed=OFF

Error log if using the docker name:
[10/27/2021] [7:59:39 AM] [Global ] › ✖ error getaddrinfo ENOTFOUND "mariadb"

Error log if using the docker ip
[10/27/2021] [8:17:49 AM] [Global ] › ✖ error getaddrinfo ENOTFOUND "172.42.0.60"

Trying to access the database with adminer using mariadb or the ip works so i know the database is available and able to be connected to.

### Solution found: Removing the ' or " from the env var declaration

environment:
          - DB_MYSQL_HOST=mariadb
          - DB_MYSQL_PORT=3306
          - DB_MYSQL_USER=npm
          - DB_MYSQL_PASSWORD=CHANGEMEDBPASS
          - DB_MYSQL_NAME=npm
<!-- gh-comment-id:952661544 --> @UbioZur commented on GitHub (Oct 27, 2021): Same problem here. Linux Debian 11 5.10.0-9-amd64 Docker version 20.10.10, build b485636 docker-compose version 1.25.0, build unknown NPM docker-compose file ``` npm-open: container_name: npm-open image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped networks: proxy: ipv4_address: 172.42.0.3 hostname: npm-open ports: - '80:80' - '81:81' - '443:443' volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - ${HOME}/internal/npm/data:/data - ${HOME}/internal/letsencrypt:/etc/letsencrypt environment: - DB_MYSQL_HOST="mariadb" - DB_MYSQL_PORT=3306 - DB_MYSQL_USER="npm" - DB_MYSQL_PASSWORD="CHANGEMEDBPASS" - DB_MYSQL_NAME="npm" - PUID=1000 - PGID=1000 labels: - com.centurylinklabs.watchtower.monitor-only ``` DATABASE docker-compose file ``` mariadb: container_name: mariadb image: "mariadb:10.6.4" restart: unless-stopped networks: proxy: ipv4_address: 172.42.0.60 hostname: mariadb volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - ${HOME}/internal/mariadb/mysql:/var/lib/mysql - ${HOME}/logs/mariadb:/var/lib/mysql/logs environment: - PUID=1000 - PGID=1000 labels: - com.centurylinklabs.watchtower.enable="false" # Fix DB error with mariaDB 10.6.0 https://github.com/nextcloud/docker/issues/1492 command: --innodb-read-only-compressed=OFF ``` Error log if using the docker name: `[10/27/2021] [7:59:39 AM] [Global ] › ✖ error getaddrinfo ENOTFOUND "mariadb"` Error log if using the docker ip `[10/27/2021] [8:17:49 AM] [Global ] › ✖ error getaddrinfo ENOTFOUND "172.42.0.60"` Trying to access the database with adminer using mariadb or the ip works so i know the database is available and able to be connected to. **### Solution found: Removing the `'` or `"` from the env var declaration** ``` environment: - DB_MYSQL_HOST=mariadb - DB_MYSQL_PORT=3306 - DB_MYSQL_USER=npm - DB_MYSQL_PASSWORD=CHANGEMEDBPASS - DB_MYSQL_NAME=npm ```
Author
Owner

@chaptergy commented on GitHub (Oct 27, 2021):

@UbioZur It that is all you have in your compose files the issue is that the network proxy is unknown in that compose project. You'll net to create the network in one of the compose files with something like this:

npm-open:
  image: 'jc21/nginx-proxy-manager:latest'
  networks:
    proxy:
      ipv4_address: 172.42.0.3
[...]
networks:
  proxy:
    name: proxy_network

and reference it in the other file

mariadb:
  image: "mariadb:10.6.4"
  networks:
    proxy:
      ipv4_address: 172.42.0.60
[...]
networks:
  proxy:
    external:
      name: proxy_network

Alternatively you can manually create the network via the docker cli and reference the network as external in both files.

<!-- gh-comment-id:952678207 --> @chaptergy commented on GitHub (Oct 27, 2021): @UbioZur It that is all you have in your compose files the issue is that the network `proxy` is unknown in that compose project. You'll net to create the network in one of the compose files with something like this: ```yml npm-open: image: 'jc21/nginx-proxy-manager:latest' networks: proxy: ipv4_address: 172.42.0.3 [...] networks: proxy: name: proxy_network ``` and reference it in the other file ```yml mariadb: image: "mariadb:10.6.4" networks: proxy: ipv4_address: 172.42.0.60 [...] networks: proxy: external: name: proxy_network ``` Alternatively you can manually create the network via the docker cli and reference the network as external in both files.
Author
Owner

@UbioZur commented on GitHub (Oct 27, 2021):

@UbioZur It that is all you have in your compose files the issue is that the network proxy is unknown in that compose project. You'll net to create the network in one of the compose files with something like this:

Alternatively you can manually create the network via the docker cli and reference the network as external in both files.

I try to keep one docker-compose file per containers. the problem was not the network (as it did work very well with adminer).

The single or double quote on the database env variable were my issue,
I just found out as they were included in the log file as 'mariadb' or "mariadb" depending how it was written in the env variable.
I will edit my previous comment to reflect the solution i found.

Probably would need to get that change on the website: https://nginxproxymanager.com/setup/#running-the-app

<!-- gh-comment-id:952685052 --> @UbioZur commented on GitHub (Oct 27, 2021): > @UbioZur It that is all you have in your compose files the issue is that the network `proxy` is unknown in that compose project. You'll net to create the network in one of the compose files with something like this: > > Alternatively you can manually create the network via the docker cli and reference the network as external in both files. I try to keep one docker-compose file per containers. the problem was not the network (as it did work very well with adminer). The single or double quote on the database env variable were my issue, I just found out as they were included in the log file as 'mariadb' or "mariadb" depending how it was written in the env variable. I will edit my previous comment to reflect the solution i found. Probably would need to get that change on the website: https://nginxproxymanager.com/setup/#running-the-app
Author
Owner

@chaptergy commented on GitHub (Oct 27, 2021):

Ah, yeah when you use the list syntax

environment:
  - DB_MYSQL_HOST="mariadb"

the quotes are included in the value. But when you use the map syntax

environment:
  DB_MYSQL_HOST: "mariadb"

as we do on the website you linked, the quotes are correctly not included in the value. Also see https://github.com/docker/compose/issues/2854.

<!-- gh-comment-id:952695830 --> @chaptergy commented on GitHub (Oct 27, 2021): Ah, yeah when you use the list syntax ```yml environment: - DB_MYSQL_HOST="mariadb" ``` the quotes are included in the value. But when you use the map syntax ```yml environment: DB_MYSQL_HOST: "mariadb" ``` as we do on the website you linked, the quotes are correctly not included in the value. Also see https://github.com/docker/compose/issues/2854.
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#906
No description provided.