AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 822929
Accepted
Rémy
Rémy
Asked: 2016-12-28 14:41:09 +0800 CST2016-12-28 14:41:09 +0800 CST 2016-12-28 14:41:09 +0800 CST

在 nginx 反向代理后面访问 synology DSM

  • 772

我正在尝试在我的树莓上运行的 nginx 反向代理后面访问我的 synology nas web ui。Nginx 反向代理适用于其他东西,比如我的幽灵博客。我复制/粘贴设置以通过 nas.my.domain 访问我的 nas 的 192.168.0.123:5000,但我得到的是“Synology / 抱歉,找不到页面”而不是 DSM 的登录提示。

这是我的 nginx 的设置

upstream nas {
       server 192.168.0.123:5001;
       # server 192.168.0.123:5000; KO
       # server 192.168.0.123; KO
}

server {
        listen 80;
        return 302 https://$server_name$request_uri;
}

server {
    server_name nas.my.domain;

    listen 443 ssl http2;
    # listen [::]:443 ssl http2;

    access_log  /var/log/nginx/nas.access.log;
    error_log   /var/log/nginx/nas.error.log;

        ssl_certificate /etc/letsencrypt/live/nas.my.domain/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/nas.my.domain/privkey.pem;
        include /etc/nginx/include/diffie-hellman;

        client_max_body_size 2m;

        location ~* \.(?:ico|css|js|gif|jpe?g|png|ttf|woff|)$ {
            access_log off;
            expires 30d;
            add_header Pragma public;
            add_header Cache-Control "public, mustrevalidate, proxy-revalidate";
            proxy_pass https://nas;
        }

        location / {
            proxy_set_header HOST $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-NginX-Proxy true;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
            proxy_pass https://nas;
            proxy_redirect off;
            proxy_buffering off;
        }

}

在 nas 内部,我使用 nas.my.domain http = 80 和 https = 443 设置控制面板/外部访问/高级。

有什么想法可以解决或解决这个问题吗?

此致,

nginx synology dsm
  • 1 1 个回答
  • 10658 Views

1 个回答

  • Voted
  1. Best Answer
    Rémy
    2016-12-30T07:52:46+08:002016-12-30T07:52:46+08:00

    我设法让它工作,不知道为什么

    • 只有端口 443 以某种方式做出了反应
    • 在我将所有标头从位置 / 到位置以进行图像缓存之前,它之前都是白色的。
        upstream nas {
               server 192.168.0.123:443;
        }
    
        server {
                listen 80;
                return 302 https://$server_name$request_uri;
        }
    
        server {
            server_name nas.my.domain;
    
            listen 443 ssl http2;
            # listen [::]:443 ssl http2;
    
            access_log  /var/log/nginx/nas.access.log;
            error_log   /var/log/nginx/nas.error.log;
    
                ssl_certificate /etc/letsencrypt/live/nas.my.domain/fullchain.pem;
                ssl_certificate_key /etc/letsencrypt/live/nas.my.domain/privkey.pem;
                include /etc/nginx/include/diffie-hellman;
    
                client_max_body_size 2m;
    
                location ~* \.(?:ico|css|js|gif|jpe?g|png|ttf|woff|)$ {
                    access_log off;
                    expires 30d;
                    add_header Pragma public;
                    add_header Cache-Control "public, mustrevalidate, proxy-revalidate";
                    proxy_set_header HOST $http_host;
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header X-NginX-Proxy true;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
                    proxy_pass https://nas;
                    proxy_redirect off;
                    proxy_buffering off;
                }
    
                location / {
                    proxy_set_header HOST $http_host;
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header X-NginX-Proxy true;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
                    proxy_pass https://nas;
                    proxy_redirect off;
                    proxy_buffering off;
                }
    
        }
    
    • 1

相关问题

  • Gzip 与反向代理缓存

  • nginx 作为代理的行为

  • Nginx 学习资源 [关闭]

  • 提供 70,000 个静态文件 (jpg) 的最佳方式?

  • 在 Apache、LightTPD 和 Nginx Web 服务器上提供 PHP 5.x 应用程序的现状?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve