Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

服务选择内“本站”不可用(搞很久了希望大佬帮助一下) #195

Closed
richardlzs opened this issue Jun 8, 2023 · 8 comments

Comments

@richardlzs
Copy link

请问要"本站"选项能够工作,具体需要如何配置?
是需要配置特定的环境变量?
还是需要nginx将本站根目录的流量转发到cloudflare的聊天服务器上?

使用版本:release 1.8.7

目前直接在服务选择里面输入自定义的聊天服务器网址是能够工作的,但为了方便还是希望能够直接能点一个选项就连上。

@adams549659584
Copy link
Owner

如果 docker 部署,配置参考下 #71 ,用 nginx 的话需要配置下 ws 的路径

@richardlzs
Copy link
Author

我是直接在linux上面直接运行解压之后的release版本的,能具体说说ws的路径要怎么配置吗。是将 location /sydney/ChatHub 的块直接proxy_pass到cloudflare聊天服务器吗(我目前是这样做的,似乎不行)

附带上我目前location /sydney/ChatHub的配置
location /sydney/ChatHub {
proxy_pass https://我的聊天服务器的域名;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
#proxy_set_header Connection $connection_upgrade;#此行nginx版本过低不识别,是这个问题吗?
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
}

@gevikhn
Copy link

gevikhn commented Jun 12, 2023

我时这样配置的nginx,聊天服务器可以选择本站,8080是聊天服务器,使用docker部署的

location /sydney/ChatHub {
              proxy_pass http://172.17.0.1:8080;
              proxy_http_version                 1.1;
              proxy_set_header Upgrade           $http_upgrade;
              proxy_set_header Connection        $connection_upgrade;
              proxy_set_header Host              $host;
              proxy_set_header X-Forwarded-Proto $scheme;
              proxy_set_header X-Forwarded-Host  $host;
              proxy_set_header X-Forwarded-Port  $server_port;
        }

        location / {
                proxy_pass http://172.17.0.1:8080;

                proxy_redirect  http:// https://;
                proxy_set_header Host              $host:$server_port;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Forwarded-Host  $host;
                proxy_set_header X-Forwarded-Port  $server_port;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        location ~ .*\.(js|css|jpg|jpeg|gif|png|ico|pdf|txt)$ {
                proxy_pass http://172.17.0.1:8080;

                proxy_set_header Host              $host:$server_port;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Forwarded-Host  $host;
                proxy_set_header X-Forwarded-Port  $server_port;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            }

@billysingo
Copy link

我是直接在linux上面直接运行解压之后的release版本的,能具体说说ws的路径要怎么配置吗。是将 location /sydney/ChatHub 的块直接proxy_pass到cloudflare聊天服务器吗(我目前是这样做的,似乎不行)

附带上我目前location /sydney/ChatHub的配置 location /sydney/ChatHub { proxy_pass https://我的聊天服务器的域名; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; #proxy_set_header Connection $connection_upgrade;#此行nginx版本过低不识别,是这个问题吗? proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Port $server_port; }

老版本就用 proxy_set_header Connection "upgrade";

@fanrengyiping
Copy link

fanrengyiping commented Jun 13, 2023 via email

@richardlzs
Copy link
Author

谢谢各位大佬

@kanglehao
Copy link

我时这样配置的nginx,聊天服务器可以选择本站,8080是聊天服务器,使用docker部署的

location /sydney/ChatHub {
              proxy_pass http://172.17.0.1:8080;
              proxy_http_version                 1.1;
              proxy_set_header Upgrade           $http_upgrade;
              proxy_set_header Connection        $connection_upgrade;
              proxy_set_header Host              $host;
              proxy_set_header X-Forwarded-Proto $scheme;
              proxy_set_header X-Forwarded-Host  $host;
              proxy_set_header X-Forwarded-Port  $server_port;
        }

        location / {
                proxy_pass http://172.17.0.1:8080;

                proxy_redirect  http:// https://;
                proxy_set_header Host              $host:$server_port;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Forwarded-Host  $host;
                proxy_set_header X-Forwarded-Port  $server_port;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        location ~ .*\.(js|css|jpg|jpeg|gif|png|ico|pdf|txt)$ {
                proxy_pass http://172.17.0.1:8080;

                proxy_set_header Host              $host:$server_port;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Forwarded-Host  $host;
                proxy_set_header X-Forwarded-Port  $server_port;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            }

这个可行,解决了~我原来的配置是
location / {
proxy_pass http://127.0.0.1:8080/;
rewrite ^/(.*)$ /$1 break;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade-Insecure-Requests 1;
proxy_set_header X-Forwarded-Proto https;
}

@Nothingness-Void
Copy link

Nothingness-Void commented Jul 21, 2023

我时这样配置的nginx,聊天服务器可以选择本站,8080是聊天服务器,使用docker部署的

location /sydney/ChatHub {
              proxy_pass http://172.17.0.1:8080;
              proxy_http_version                 1.1;
              proxy_set_header Upgrade           $http_upgrade;
              proxy_set_header Connection        $connection_upgrade;
              proxy_set_header Host              $host;
              proxy_set_header X-Forwarded-Proto $scheme;
              proxy_set_header X-Forwarded-Host  $host;
              proxy_set_header X-Forwarded-Port  $server_port;
        }

        location / {
                proxy_pass http://172.17.0.1:8080;

                proxy_redirect  http:// https://;
                proxy_set_header Host              $host:$server_port;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Forwarded-Host  $host;
                proxy_set_header X-Forwarded-Port  $server_port;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        location ~ .*\.(js|css|jpg|jpeg|gif|png|ico|pdf|txt)$ {
                proxy_pass http://172.17.0.1:8080;

                proxy_set_header Host              $host:$server_port;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Forwarded-Host  $host;
                proxy_set_header X-Forwarded-Port  $server_port;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            }

我在windows部署,完全照搬这个nginx配置但是本站依然不可用,linux正常

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants