通过 Docker 上的 nginx 代理时 Syncthing webGUI 损坏

通过 Docker 上的 nginx 代理时 Syncthing webGUI 损坏

我想使用 docker 在我的 Ubunty 18.04 服务器上部署 syncthing。

我使用 nginx 作为反向代理,因此 WebGUI 流量使用我的证书通过 SSL 传输。但是,当通过 nginx 代理时打开 webGUI 时,它看起来像这样https://i.stack.imgur.com/UdhYO.png

我在 Google 上发现另一个人遇到此问题,但没有找到解决方案...有人知道发生了什么吗?

我的docker-compose.yml:

version: '3'

services:

  nginx:
    image: nginx:latest
    container_name: nginx-1
    networks:
      - syncthing
    ports:
      - "80:80"
      - "443:443"
    restart: always
    volumes:
      - ./www:/var/www
      - ./nginx/:/etc/nginx
      - ./nginx/log:/var/log/nginx
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"

  syncthing:
    image: linuxserver/syncthing
    container_name: syncthing-1
    networks:
      - syncthing
    ports:
        #webUI 
      - 8384:8384
        #listening  
      - 22000:22000
        #port discovery
      - 21027:21027/udp
    restart: always
    volumes:
      - ./syncthing/config:/config
      - ./syncthing/data:/data
    environment:
      - TZ=CET

  letsencrypt:
    image: certbot/certbot
    command: renew
    container_name: letsencrypt-1
    networks:
      - le
    depends_on:
      - nginx
    restart: always
    volumes:
      - ./letsencrypt:/etc/letsencrypt
      - ./letsencrypt/log:/var/log/letsencrypt
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"


networks:
  syncthing:

还有我的同步 nginx 站点启用文件:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name example.com;
    root /;

    # SSL
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;

    # reverse proxy
    location /syncthing {
        proxy_pass http://syncthing:8384;

        proxy_read_timeout      600s;
        proxy_send_timeout      600s;    

        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

# HTTP redirect
server {
    listen 80;
    listen [::]:80;

    server_name example.com;

    location / {
        return 301 https://example.com$request_uri;
    }
}

相关内容