首页 > 解决方案 > Synology DSM 上的 Nginx 反向代理在更新到 DSM 6.2.2 Update 3 后停止工作

问题描述

在 Reddit 上的这篇文章之后,我有一个带有自定义设置的 DS415+,用于在 Docker 容器中运行的多个服务的反向代理。在我更新到 DSM 6.2.2 Update 3 之前,一切都运行良好。从那时起,尝试访问这些服务会导致超时,尽管 curl-ing localhost:port 或 DiskStation_LAN_address:port 工作正常。

我尝试从 LetsEncrypt 更新证书,一次取出一些选项,通过以下方式清除连接:

proxy_set_header        Connection          "";

没有任何效果...

这是我的自定义 server.conf 文件:

server {
    listen 80;
    listen [::]:80;

    server_name XXXXXXX.XXXXXXXX.XXX;

    # Include this if you want to get a letsencrypt certificate for the domain you're using
    location ^~ /.well-known/acme-challenge/ {
        auth_basic off;
        root /var/lib/letsencrypt;
        default_type "text/plain";
    }

    # Include this if you want to automatically redirect to HTTPS
    location / {
        return 301 https://XXXXXXX.XXXXXXXX.XXX$request_uri;
    }
}

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

    server_name XXXXXXX.XXXXXXXX.XXX;

    large_client_header_buffers 4 32k;

    # Include these if you want to use a specific certificate,
    # you'll need to find the location of the letsencrypt after you get it...
    # so this might need to be updated afterwards
    ssl_certificate /usr/syno/etc/certificate/_archive/XXXXXX/fullchain.pem;
    ssl_certificate_key /usr/syno/etc/certificate/_archive/XXXXXX/privkey.pem;
    # add_header Strict-Transport-Security "max-age=15768000; includeSubdomains; preload" always;

    # Include this if you want basic authentication required
    # auth_basic “Restricted”;
    # auth_basic_user_file /etc/nginx/.htpasswd;

    # Sonarr, requires Sonarr update webhome configuration to match
    location /sonarr {
        proxy_set_header        Host                $http_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-Proto   $scheme;
        proxy_set_header        Connection          "";
        proxy_intercept_errors  on;
       proxy_http_version      1.1;

       proxy_pass http://localhost:8989;

       proxy_redirect default;
    }
}

有没有人有任何建议来诊断超时发生的原因,并希望有一个解决方案?正如我所说,服务正在运行,可以使用 NAS 地址+端口访问,但不能从外部访问。nginx 是 1.15.7 版本。提前谢谢了!

标签: nginxreverse-proxysynology

解决方案


我觉得很愚蠢……结果,无论出于何种原因,我路由器上的端口转发规则已重置。一旦我恢复它们,一切都运行良好。


推荐阅读