Nginx代理管理器:转发到相同Docker网络的Docker容器时,连接被拒绝

时间:2020-10-12 20:51:25

标签: docker docker-compose nginx-reverse-proxy

我的反向代理管理器(Nginx代理管理器)与同一个docker网络的docker容器之间的连接被拒绝。我只是想不通为什么拒绝连接。我觉得解决方法很简单。我希望你能帮助我。

这是我的日志和设置:

尝试访问时:(在http和https上)

grafik

来自错误日志:

2020/10/08 18:03:02 [error] 269#269: *5 connect() failed (111: Connection refused) while connecting to upstream, client: 172.19.0.1, server: ***.duckdns.org, request: "GET / HTTP/1.1", upstream: "http://172.19.0.3:80/", host: "***.duckdns.org"
2020/10/08 18:03:03 [error] 269#269: *8 connect() failed (111: Connection refused) while connecting to upstream, client: 172.19.0.1, server: ***.duckdns.org, request: "GET / HTTP/2.0", upstream: "http://172.19.0.3:80/", host: "***.duckdns.org"

docker-compose.yml:

version: "3.7"

services: 
  jetty:
    container_name: jetty
    image: jetty:9
    ports:
      - '80'
    volumes:
      - './jetty/webapps:/var/lib/jetty/webapps'
  # for reverse proxy
  nginx-pm:
    container_name: nginx-pm
    image: jc21/nginx-proxy-manager:2
    restart: always
    ports:
    - 80:80 # Public HTTP Port
    - 443:443 # Public HTTPS Port:
    - 81:81 # Admin Web Port:
    volumes:
    - ./nginx-proxy-manager/config.json:/app/config/production.json
    - ./nginx-proxy-manager/data:/data
    - ./nginx-proxy-manager/letsencrypt:/etc/letsencrypt

代理主机设置:

grafik

1 个答案:

答案 0 :(得分:0)

最初怀疑是

...的确很简单,但是花了我几天的时间-.-我只是以为码头集装箱的端口是错误的(默认),因为码头的默认端口是8080,但我改用80 。结果,我也不得不相应地调整代理主机设置。


  jetty:
    container_name: jetty
    image: jetty:9
    ports:
      - '8080' # <---