[GH-ISSUE #536] Bad Gateway, ECONNREFUSED #456

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

Originally created by @thehedgefrog on GitHub (Aug 1, 2020).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/536

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image?
    Yes
  • Are you sure you're not using someone else's docker image?
    Yes
  • If having problems with Lets Encrypt, have you made absolutely sure your site is accessible from outside of your network?
    N/A

Describe the bug

  • A clear and concise description of what the bug is.
    Will not connect to the database, error ECONNREFUSED and then it times out. Tried multiple ways. I can ping db just fine from the app console.
  • What version of Nginx Proxy Manager is reported on the login page?
    v2.3.1

config.json

{
  "database": {
    "engine": "mysql",
    "host": "db",
    "name": "npm",
    "user": "npm",
    "password": "mypassword",
    "port": 3306
  }
}

docker-compose.yml

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
    environment:
      # Uncomment this if IPv6 is not enabled on your host
      DISABLE_IPV6: "true"
    volumes:
      # Make sure this config.json file exists as per instructions above:
      - /share/Docker/NGINXPM/config.json:/app/config/production.json
      - /share/Docker/NGINXPM/data:/data
      - /share/Docker/NGINXPM/letsencrypt:/etc/letsencrypt
    depends_on:
      - db
  db:
    image: mariadb:latest
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: "myrootpassword"
      MYSQL_DATABASE: "npm"
      MYSQL_USER: "npm"
      MYSQL_PASSWORD: "mypassword"
    volumes:
      - /share/Docker/NGINXPM/data/mysql:/var/lib/mysql

DB Logs

2020-08-01 01:13:14+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.4+maria~focal started.

2020-08-01 01:13:14+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'

2020-08-01 01:13:14+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.4+maria~focal started.

2020-08-01 1:13:15 0 [Note] mysqld (mysqld 10.5.4-MariaDB-1:10.5.4+maria~focal) starting as process 1 ...

2020-08-01 1:13:15 0 [Note] InnoDB: Using Linux native AIO

2020-08-01 1:13:15 0 [Note] InnoDB: Uses event mutexes

2020-08-01 1:13:15 0 [Note] InnoDB: Compressed tables use zlib 1.2.11

2020-08-01 1:13:15 0 [Note] InnoDB: Number of pools: 1

2020-08-01 1:13:15 0 [Note] InnoDB: Using SSE4.2 crc32 instructions

2020-08-01 1:13:15 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)

2020-08-01 1:13:15 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728

2020-08-01 1:13:15 0 [Note] InnoDB: Completed initialization of buffer pool

2020-08-01 1:13:15 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().

2020-08-01 1:13:15 0 [Note] InnoDB: 128 rollback segments are active.

2020-08-01 1:13:15 0 [Note] InnoDB: Creating shared tablespace for temporary tables

2020-08-01 1:13:15 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...

2020-08-01 1:13:15 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.

2020-08-01 1:13:15 0 [Note] InnoDB: 10.5.4 started; log sequence number 45093; transaction id 21

2020-08-01 1:13:15 0 [Note] Plugin 'FEEDBACK' is disabled.

2020-08-01 1:13:15 0 [Note] Server socket created on IP: '::'.

2020-08-01 1:13:15 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool

2020-08-01 1:13:15 0 [Note] InnoDB: Buffer pool(s) load completed at 200801 1:13:15

2020-08-01 1:13:15 0 [Warning] 'proxies_priv' entry '@% root@ac19879d292b' ignored in --skip-name-resolve mode.

2020-08-01 1:13:15 0 [Note] Reading of all Master_info entries succeeded

2020-08-01 1:13:15 0 [Note] Added new Master_info '' to hash table

2020-08-01 1:13:15 0 [Note] mysqld: ready for connections.

Version: '10.5.4-MariaDB-1:10.5.4+maria~focal' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution

App log

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.

[s6-init] ensuring user provided files have correct perms...exited 0.

[fix-attrs.d] applying ownership & permissions fixes...

[fix-attrs.d] done.

[cont-init.d] executing container initialization scripts...

[cont-init.d] done.

[services.d] starting services

[services.d] done.

Generating dummy SSL certificate...

Generating a RSA private key

...............+++++

...................................................................+++++

writing new private key to '/data/nginx/dummykey.pem'


Complete

Disabling IPV6 in hosts

❯ Disabling IPV6 in hosts: /etc/nginx/conf.d

❯ /etc/nginx/conf.d/default.conf

❯ /etc/nginx/conf.d/include/assets.conf

❯ /etc/nginx/conf.d/include/block-exploits.conf

❯ /etc/nginx/conf.d/include/force-ssl.conf

❯ /etc/nginx/conf.d/include/ip_ranges.conf

❯ /etc/nginx/conf.d/include/letsencrypt-acme-challenge.conf

❯ /etc/nginx/conf.d/include/proxy.conf

❯ /etc/nginx/conf.d/include/ssl-ciphers.conf

❯ /etc/nginx/conf.d/include/resolvers.conf

❯ /etc/nginx/conf.d/production.conf

Disabling IPV6 in hosts

❯ Disabling IPV6 in hosts: /data/nginx

[8/1/2020] [1:22:52 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:22:53 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:22:54 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:22:55 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:22:56 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:22:57 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:22:58 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:22:59 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:00 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:01 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:02 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:03 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:04 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:05 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:06 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:07 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:08 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:09 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:10 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:11 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:12 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:13 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:14 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:15 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:16 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:17 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:18 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:19 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:20 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:21 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:22 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306

[8/1/2020] [1:23:33 AM] [Global ] › ✖ error connect ETIMEDOUT

Operating System
QNAP with latest QTS, Portainer 1.24.1

Additional context
At a loss here, tried everything.

Originally created by @thehedgefrog on GitHub (Aug 1, 2020). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/536 **Checklist** - Have you pulled and found the error with `jc21/nginx-proxy-manager:latest` docker image? Yes - Are you sure you're not using someone else's docker image? Yes - If having problems with Lets Encrypt, have you made absolutely sure your site is accessible from outside of your network? N/A **Describe the bug** - A clear and concise description of what the bug is. Will not connect to the database, error ECONNREFUSED and then it times out. Tried multiple ways. I can ping db just fine from the app console. - What version of Nginx Proxy Manager is reported on the login page? v2.3.1 config.json ``` { "database": { "engine": "mysql", "host": "db", "name": "npm", "user": "npm", "password": "mypassword", "port": 3306 } } ``` docker-compose.yml ``` 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 environment: # Uncomment this if IPv6 is not enabled on your host DISABLE_IPV6: "true" volumes: # Make sure this config.json file exists as per instructions above: - /share/Docker/NGINXPM/config.json:/app/config/production.json - /share/Docker/NGINXPM/data:/data - /share/Docker/NGINXPM/letsencrypt:/etc/letsencrypt depends_on: - db db: image: mariadb:latest restart: always environment: MYSQL_ROOT_PASSWORD: "myrootpassword" MYSQL_DATABASE: "npm" MYSQL_USER: "npm" MYSQL_PASSWORD: "mypassword" volumes: - /share/Docker/NGINXPM/data/mysql:/var/lib/mysql ``` DB Logs > 2020-08-01 01:13:14+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.4+maria~focal started. > > > 2020-08-01 01:13:14+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' > > > 2020-08-01 01:13:14+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.4+maria~focal started. > > > 2020-08-01 1:13:15 0 [Note] mysqld (mysqld 10.5.4-MariaDB-1:10.5.4+maria~focal) starting as process 1 ... > > > 2020-08-01 1:13:15 0 [Note] InnoDB: Using Linux native AIO > > > 2020-08-01 1:13:15 0 [Note] InnoDB: Uses event mutexes > > > 2020-08-01 1:13:15 0 [Note] InnoDB: Compressed tables use zlib 1.2.11 > > > 2020-08-01 1:13:15 0 [Note] InnoDB: Number of pools: 1 > > > 2020-08-01 1:13:15 0 [Note] InnoDB: Using SSE4.2 crc32 instructions > > > 2020-08-01 1:13:15 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts) > > > 2020-08-01 1:13:15 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728 > > > 2020-08-01 1:13:15 0 [Note] InnoDB: Completed initialization of buffer pool > > > 2020-08-01 1:13:15 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). > > > 2020-08-01 1:13:15 0 [Note] InnoDB: 128 rollback segments are active. > > > 2020-08-01 1:13:15 0 [Note] InnoDB: Creating shared tablespace for temporary tables > > > 2020-08-01 1:13:15 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... > > > 2020-08-01 1:13:15 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. > > > 2020-08-01 1:13:15 0 [Note] InnoDB: 10.5.4 started; log sequence number 45093; transaction id 21 > > > 2020-08-01 1:13:15 0 [Note] Plugin 'FEEDBACK' is disabled. > > > 2020-08-01 1:13:15 0 [Note] Server socket created on IP: '::'. > > > 2020-08-01 1:13:15 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool > > > 2020-08-01 1:13:15 0 [Note] InnoDB: Buffer pool(s) load completed at 200801 1:13:15 > > > 2020-08-01 1:13:15 0 [Warning] 'proxies_priv' entry '@% root@ac19879d292b' ignored in --skip-name-resolve mode. > > > 2020-08-01 1:13:15 0 [Note] Reading of all Master_info entries succeeded > > > 2020-08-01 1:13:15 0 [Note] Added new Master_info '' to hash table > > > 2020-08-01 1:13:15 0 [Note] mysqld: ready for connections. > > > Version: '10.5.4-MariaDB-1:10.5.4+maria~focal' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution App log > [s6-init] making user provided files available at /var/run/s6/etc...exited 0. > > > [s6-init] ensuring user provided files have correct perms...exited 0. > > > [fix-attrs.d] applying ownership & permissions fixes... > > > [fix-attrs.d] done. > > > [cont-init.d] executing container initialization scripts... > > > [cont-init.d] done. > > > [services.d] starting services > > > [services.d] done. > > > Generating dummy SSL certificate... > > > Generating a RSA private key > > > ...............+++++ > > > ...................................................................+++++ > > > writing new private key to '/data/nginx/dummykey.pem' > > > ----- > > > Complete > > > Disabling IPV6 in hosts > > > ❯ Disabling IPV6 in hosts: /etc/nginx/conf.d > > > ❯ /etc/nginx/conf.d/default.conf > > > ❯ /etc/nginx/conf.d/include/assets.conf > > > ❯ /etc/nginx/conf.d/include/block-exploits.conf > > > ❯ /etc/nginx/conf.d/include/force-ssl.conf > > > ❯ /etc/nginx/conf.d/include/ip_ranges.conf > > > ❯ /etc/nginx/conf.d/include/letsencrypt-acme-challenge.conf > > > ❯ /etc/nginx/conf.d/include/proxy.conf > > > ❯ /etc/nginx/conf.d/include/ssl-ciphers.conf > > > ❯ /etc/nginx/conf.d/include/resolvers.conf > > > ❯ /etc/nginx/conf.d/production.conf > > > Disabling IPV6 in hosts > > > ❯ Disabling IPV6 in hosts: /data/nginx > > > [8/1/2020] [1:22:52 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:22:53 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:22:54 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:22:55 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:22:56 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:22:57 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:22:58 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:22:59 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:00 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:01 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:02 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:03 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:04 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:05 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:06 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:07 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:08 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:09 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:10 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:11 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:12 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:13 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:14 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:15 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:16 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:17 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:18 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:19 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:20 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:21 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:22 AM] [Global ] › ✖ error connect ECONNREFUSED 172.29.0.2:3306 > > > [8/1/2020] [1:23:33 AM] [Global ] › ✖ error connect ETIMEDOUT **Operating System** QNAP with latest QTS, Portainer 1.24.1 **Additional context** At a loss here, tried everything.
kerem 2026-02-26 06:32:55 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@codeagencybe commented on GitHub (Sep 19, 2020):

@wschlotter

I got it working!

db_1 | 2020-09-19 12:31:16 0 [ERROR] InnoDB: The Auto-extending innodb_system data file './ibdata1' is of a different size 0 pages than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!

All I did was delete the .ibdata1 file that shows 0kb
And then re-deploy the whole setup. Now it generates a new clean .ibdata file that is around 12Mb size

<!-- gh-comment-id:695208286 --> @codeagencybe commented on GitHub (Sep 19, 2020): @wschlotter I got it working! `db_1 | 2020-09-19 12:31:16 0 [ERROR] InnoDB: The Auto-extending innodb_system data file './ibdata1' is of a different size 0 pages than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages! ` All I did was delete the .ibdata1 file that shows 0kb And then re-deploy the whole setup. Now it generates a new clean .ibdata file that is around 12Mb size
Author
Owner

@Iron-Merlin-2000 commented on GitHub (Sep 26, 2020):

@codeagencybe

due to the fact that if have the same issue with my installation and I'm not too deep into docker, I'd like to ask how to delete the .ibdata1 file ? Can this be done when the container is up an running ?

<!-- gh-comment-id:699521219 --> @Iron-Merlin-2000 commented on GitHub (Sep 26, 2020): @codeagencybe due to the fact that if have the same issue with my installation and I'm not too deep into docker, I'd like to ask how to delete the .ibdata1 file ? Can this be done when the container is up an running ?
Author
Owner

@codeagencybe commented on GitHub (Sep 27, 2020):

@Iron-Merlin-2000

If you do the Docker-compose up command, it will generate all those files in your volume the first run.
When that's done, ssh into server (or use SFTP) and go to the mount where you specified the app volume.
From there delete it and then redeploy again.
That's all I did and it works but this is not a permanent fix whatsoever.
It still requires a patch/fix so this doesn't happen on new deployments.

<!-- gh-comment-id:699686804 --> @codeagencybe commented on GitHub (Sep 27, 2020): @Iron-Merlin-2000 If you do the Docker-compose up command, it will generate all those files in your volume the first run. When that's done, ssh into server (or use SFTP) and go to the mount where you specified the app volume. From there delete it and then redeploy again. That's all I did and it works but this is not a permanent fix whatsoever. It still requires a patch/fix so this doesn't happen on new deployments.
Author
Owner

@cxlso commented on GitHub (Feb 24, 2021):

Hey! I'm a noob and I encounter the same problem. What do you type into your terminal to access the .ibdata1 file?

<!-- gh-comment-id:785010037 --> @cxlso commented on GitHub (Feb 24, 2021): Hey! I'm a noob and I encounter the same problem. What do you type into your terminal to access the .ibdata1 file?
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#456
No description provided.