我不能反向代理到我的unraid,但是可以路由器端口转发连接到unraid(已解决)


Recommended Posts

非常奇怪我可以确认我的反向代理是起作用的,因为我可以反向到别的服务端口上。就是不能反向代理到unread的80端口(局域网内端口),然后直接外网用路由器端口转发确可以连接到unraid。是不是unraid需要做什么设置?

Link to comment
2 hours ago, CentWind said:

docker么?然后给的br0?我之前也是这样。貌似是因为unraid如果分独立ip,unraid不能ping那个ip的。

后来我嫌麻烦,就虚拟了个群晖做反向代理。。。

网络类型是bridge,我威联通装的nginx反向代理unraidi都不行,不知道哪里出了问题

Link to comment
  • lyqalex changed the title to 我不能反向代理到我的unraid,但是可以路由器端口转发连接到unraid(已解决)
  • 3 weeks later...

除此之外,我发现也没法在外网ssh连接unraid,比如:

Quote

☺ ssh unraid -vvv
OpenSSH_7.6p1 Ubuntu-4ubuntu0.4, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /home/test/.ssh/config
debug1: /home/test/.ssh/config line 13: Applying options for unraid
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "tingyu.fun" port 27456
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to tingyu.fun [123.112.241.39] port 27456.
debug1: Connection established.
debug1: identity file /home/test/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/test/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.4
ssh_exchange_identification: read: Connection reset by peer

但是我从局域网就可以正常连接~快把我搞死了

Link to comment
48 minutes ago, tingyu said:

很巧,我也是用的这个docker镜像,求分享一下unraid的nginx配置~

我也是小白也是一点一点摸索的。
1、你要分步排查,首先nginx能不能运行起来。nginx有个web端口就是我映射的20081(配置代理网址用的),接着我所有访问的网址都是都访问另外一个20080端口,访问这个端口后nginx会根据你的配置代理到正确地址。我路由器端口映射就是外网映射到20080端口的。
2、SSH我没外网访问,我直接用的是unraid里直接可以打开终端的那个。你可以在【设置】-【管理权限】看下有没有打开功能。

1.png

Link to comment
20 minutes ago, xing said:

我也是小白也是一点一点摸索的。
1、你要分步排查,首先nginx能不能运行起来。nginx有个web端口就是我映射的20081(配置代理网址用的),接着我所有访问的网址都是都访问另外一个20080端口,访问这个端口后nginx会根据你的配置代理到正确地址。我路由器端口映射就是外网映射到20080端口的。
2、SSH我没外网访问,我直接用的是unraid里直接可以打开终端的那个。你可以在【设置】-【管理权限】看下有没有打开功能。

1.png

感谢回复,我的nginx docker上也配置了其他的反射代理,比如访问一台局域网内的物理黑群晖,以及这台黑群晖上其他docker服务,比如:jellyfin。这些代理都是能在wan下访问的,但是唯独unraid的代理访问不了。另外,我还在一台软路由上部署了这个nginx docker,发现unraid也是无法从wan访问。

 

另外,大佬你不是说需要在nginx的unraid的ip上加上login后缀么,能说一下这个配置是怎么搞的么?需要配置advanced分页么??

Link to comment
1 hour ago, tingyu said:

感谢回复,我的nginx docker上也配置了其他的反射代理,比如访问一台局域网内的物理黑群晖,以及这台黑群晖上其他docker服务,比如:jellyfin。这些代理都是能在wan下访问的,但是唯独unraid的代理访问不了。另外,我还在一台软路由上部署了这个nginx docker,发现unraid也是无法从wan访问。

 

另外,大佬你不是说需要在nginx的unraid的ip上加上login后缀么,能说一下这个配置是怎么搞的么?需要配置advanced分页么??

在你现有不能访问的网址上面加一个   /login  就可以,不用配置。假如如你现在的unradi网址是:https://unraid.ceshi.com:33  (我没有备案所以有端口号),那么你就要改成:https://unraid.ceshi.com:33/login  这个

Link to comment
18 hours ago, xing said:

在你现有不能访问的网址上面加一个   /login  就可以,不用配置。假如如你现在的unradi网址是:https://unraid.ceshi.com:33  (我没有备案所以有端口号),那么你就要改成:https://unraid.ceshi.com:33/login  这个

再次感谢回复,我发现加/login的方式对我来说不好用,还是那个老问题:加了/login后我在内网是可以访问的,但是外网仍然无法访问,浏览器返回:502 Bad Gateway

Link to comment
  • 2 weeks later...
  • 5 weeks later...
server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name unraid.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    # enable for ldap auth, fill in ldap details in ldap.conf
    #include /config/nginx/ldap.conf;

    # enable for Authelia
    include /config/nginx/authelia-server.conf;

    location / {
        # enable the next two lines for http auth
        #auth_basic "Restricted";
        #auth_basic_user_file /config/nginx/.htpasswd;

        # enable the next two lines for ldap auth
        #auth_request /auth;
        #error_page 401 =200 /ldaplogin;

        # enable for Authelia
        include /config/nginx/authelia-location.conf;

        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app 192.168.0.0;
        set $upstream_port 80;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    }

我的unraid反代,用的swag

Link to comment
  • 2 weeks later...
        location / {
            proxy_pass http://$server;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $http_host;
            proxy_set_header Access-Control-Allow-Origin $server;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-NginX-Proxy true;
        }

nginx proxy manager配置,面板上cpu占用之类能动了,但是安装插件或者docker时弹出的日志面板空白,直到安装完插件才会突然显示所有日志信息,等大雕出方案抄作业。

Link to comment
  • 4 weeks later...
On 2/17/2022 at 9:24 AM, BlueFang said:
        location / {
            proxy_pass http://$server;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $http_host;
            proxy_set_header Access-Control-Allow-Origin $server;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-NginX-Proxy true;
        }

nginx proxy manager配置,面板上cpu占用之类能动了,但是安装插件或者docker时弹出的日志面板空白,直到安装完插件才会突然显示所有日志信息,等大雕出方案抄作业。

目前我已经完美搞定了,你参考一下

  • Like 1
Link to comment
  • 3 months later...
On 12/24/2021 at 11:17 AM, tingyu said:

再次感谢回复,我发现加/login的方式对我来说不好用,还是那个老问题:加了/login后我在内网是可以访问的,但是外网仍然无法访问,浏览器返回:502 Bad Gateway

兄弟,问题解决了吗?我遇到和你一样的问题了,也在到处找解决方案

Link to comment
  location / {
    set              $upstream http://你的内网ip+端口
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    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 http;
    proxy_set_header X-Nginx-Proxy true;
    proxy_redirect http:// https://;
    proxy_buffering off;
    proxy_pass       $upstream;
    
    # Force SSL
    include conf.d/include/force-ssl.conf;

  }

直接修改npm 对应unraid的反向代理配置文件。

https://note.youdao.com/web/#/file/recent/note/WEB75816a310cd68929b7fab6ef3c48e9bd/

该链接还有针对filebrowser右下角红字弹窗。

 

如果有br0与host、bridge网络模式无法互相访问的问题。可以在设置--docker--(打开右上角高级视图)--主机访问自定义网络(启用)。

 

  • Like 1
Link to comment
On 2/6/2022 at 3:25 AM, phui.chen said:
server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name unraid.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    # enable for ldap auth, fill in ldap details in ldap.conf
    #include /config/nginx/ldap.conf;

    # enable for Authelia
    include /config/nginx/authelia-server.conf;

    location / {
        # enable the next two lines for http auth
        #auth_basic "Restricted";
        #auth_basic_user_file /config/nginx/.htpasswd;

        # enable the next two lines for ldap auth
        #auth_request /auth;
        #error_page 401 =200 /ldaplogin;

        # enable for Authelia
        include /config/nginx/authelia-location.conf;

        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app 192.168.0.0;
        set $upstream_port 80;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    }

我的unraid反代,用的swag

 

同用的SWAG,unraid的反代配置(unraid.subdomain.conf)基本上跟你一模一样。

事实证明,楼主给的方法才是正确的,直接用这个配置去访问 https://域名:443映射端口 是无法打开页面的,报错ERR_CONNECTION_TIMED_OUT,必须要在这个地址后面加上子文件夹路径,比如 https://域名:443映射端口/Dashboard 才可以正常访问

 

但奇怪的是,不用反代,直接用 域名(或者外网IP)+unraid webgui端口 是可以直接访问的。

推测是没有做反代的时候,unraid可以自动将setting设置的默认打开页面修改(或者反代)为index.html主页文件,因此不加具体子文件夹路径就可以正常访问,但如果用非unraid的Nginx做一次反代,就跟原来系统自带的Nginx代理设置有些冲突,导致无法自动定位到默认页面,必须要手动指定页面路径才可以打开webgui的网页文件。

 

希望有大佬释疑一下,纯个人推测,这个问题也是让我困扰好久,反复修改配置也没有用。非常感谢楼主给出的解决思路

Edited by BladPit
错别字 typos
Link to comment
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.