Aria2-Pro-Docker icon indicating copy to clipboard operation
Aria2-Pro-Docker copied to clipboard

Nginx反代后无法连接

Open LockeJet opened this issue 3 years ago • 1 comments

以前好好的,但是升级之后出现了问题: 这是docker-compose.yml

version: "3.2"

services:

  Aria2-Pro:
    container_name: aria2-pro
    image: p3terx/aria2-pro
    environment:
      - PUID=1000
      - PGID=100
      - UMASK_SET=022
      - RPC_SECRET=secret
      - RPC_PORT=6800
      - LISTEN_PORT=6888
      - DISK_CACHE=64M
      - IPV6_MODE=false
      - UPDATE_TRACKERS=true
      - CUSTOM_TRACKER_URL=
      - TZ=Asia/Shanghai
    volumes:
      - ${PWD}/config:/config
      - ${PWD}/downloads:/downloads
# If you use host network mode, then no port mapping is required.
# This is the easiest way to use IPv6 networks.
    network_mode: host
    #network_mode: bridge
    ports:
      - 6800:6800
      - 6888:6888
      - 6888:6888/udp
    restart: unless-stopped
# Since Aria2 will continue to generate logs, limit the log size to 1M to prevent your hard disk from running out of space.
    logging:
      driver: json-file
      options:
        max-size: 1m

# AriaNg is just a static web page, usually you only need to deploy on a single host.
  AriaNg:
    container_name: ariang
    image: p3terx/ariang
    command: --port 6880 --ipv6
    network_mode: host
    #network_mode: bridge
    ports:
      - 6880:6880
    restart: unless-stopped
    logging:
      driver: json-file
      options:
        max-size: 1m

这是nginx配置文件:

server {
    listen 8081;
    root /var/www/ariang-webui;
    location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ =404;
    }
}

server {
    #listen 44381;
    listen 44381 ssl http2;
    server_name abc.xyz 0.0.0.0;
    #ssl on;
    ssl_certificate /etc/ssl/crt-usr/abc.xyz/fullchain.pem;
    ssl_certificate_key /etc/ssl/crt-usr/abc.xyz/privkey.pem;

    error_log /var/log/nginx/ariang-webui_error.log error;
    access_log /var/log/nginx/ariang-webgui_access.log combined;

    root /var/www/ariang-webui;

    # Add index.php to the list if you are using PHP
    #index index.html index.htm index.nginx-debian.html;

    location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ =404;
    #proxy_redirect http:// https://;
    #proxy_set_header Host $http_host;
    #proxy_redirect off;
    #proxy_set_header Host $host;
    #proxy_set_header X-Real-IP $remote_addr;
    #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    #proxy_pass http://127.0.0.1:6800;  #反代本地端口
    }

    location /jsonrpc {
    proxy_pass         http://localhost:6800;
    proxy_set_header   Host $host;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Host $server_name;
    }

}

用http还是https访问ARIANG页面: 无论是设置RPC地址为https://192.168.8.231:6800/rpcjson还是https://127.0.0.1:6800/rpcjson; 无论是设置RPC地址为http://192.168.8.231:6800/rpcjson还是http://127.0.0.1:6800/rpcjson; 均显示“未连接”。

用tcpdump port 6800 -i enp2s0或者tcpdump port 6800 -i lo,发现根本没有包近来! 但是防火墙是放行这些端口的!

docker logs 命令输出空白行(字符看不到,但光标确认有换行)!

请问问题出在哪里?

LockeJet avatar Mar 18 '21 11:03 LockeJet

不应该是/jsonrpc,你写的rpcjson?

BitaminKim avatar Feb 15 '22 16:02 BitaminKim