操作系统应用开发(二十五)RustDesk 502错误—东方仙盟筑基期
off999 2025-10-23 09:41 42 浏览 0 评论
编辑
这是由于配置错误
编辑
正确配置
编辑
1. 控制服务器相关端口
- 21115 (hbbs - tcp):此端口主要用于 RustDesk 控制服务器的 TCP 通信。它在客户端与控制服务器之间扮演着重要的角色,负责传输控制指令、设备信息同步等关键数据。比如,当客户端启动并尝试连接远程设备时,会通过此端口向控制服务器发送连接请求,控制服务器则通过该端口响应并协调后续的连接流程,类似于远程桌面连接流程中的 “指挥中心” 通信端口。
- 21116 (hbbs - http):通常用于控制服务器的 HTTP 协议通信。它可能用于处理一些基于 HTTP 的 API 请求,例如获取服务器状态信息、更新客户端配置等操作。以客户端获取最新的服务器策略配置为例,就可能通过此端口以 HTTP 请求的方式获取相关数据。
- 21117 (hbbr - tcp):该端口也是用于 RustDesk 控制服务器的 TCP 通信,但与 21115 端口的功能侧重点可能有所不同。它可能更专注于特定类型的控制信息传输,比如在处理复杂网络环境下的连接协商,或在大规模部署中用于服务器间的控制信息交互,保障整个远程桌面服务的稳定运行。
2. 中继服务器相关端口
- 21118 (hbbs - ws):这是与 WebSocket 协议相关的端口,主要用于 RustDesk 中继服务器的通信。WebSocket 协议在实时数据传输方面具有优势,因此该端口常用于传输实时性要求较高的数据,如远程桌面的屏幕画面数据、鼠标键盘操作指令等。当用户在远程控制端移动鼠标时,相关操作指令会通过此端口以 WebSocket 协议快速传输到被控制端,实现流畅的远程控制体验。
- 21119 (hbbr - ws):同样是用于中继服务器的 WebSocket 通信端口。它可能承担着与 21118 端口类似但又有区别的功能,比如负责不同类型的数据分流,或者在高并发场景下,协助 21118 端口分担数据传输压力,确保实时数据的稳定传输,保障远程桌面服务的高效运行。
3. 其他可能涉及的端口
- 自定义端口(UDP/TCP):在一些特殊的网络环境或自定义配置下,RustDesk 客户端之间可能会直接通过 UDP 或 TCP 协议在自定义端口上进行点对点(P2P)连接。这种方式可以在不需要中继服务器中转的情况下,直接在客户端之间传输数据,提高数据传输效率和隐私性。例如,在本地局域网环境中,用户可能配置 RustDesk 使用自定义端口进行 P2P 连接,实现快速的文件传输或远程控制,减少对中继服务器的依赖。
Login to the web page
- Open https://YOUR_DOMAIN in the browser, log in using the default user name “admin” and password “test1234”, then change the password to your own.
Add WebSocket Secure (WSS) support for the id server and relay server to enable secure communication for all platforms.
Add the following configuration to the first server section of the /etc/nginx/.../rustdesk.conf file, then restart the Nginx service. The web client can be accessed via https://YOUR_DOMAIN/web. Custom clients can use WebSocket by setting allow-websocket=Y in the advanced options. If the custom client with WebSocket enabled is used, it will not utilize TCP/UDP and can only connect through a relay (except for direct IP connections). If only this WebSocket-enabled client is used, the server can close ports 21114 to 21119 and only keep port 443 open.
location /ws/id {
proxy_pass http://127.0.0.1:21118;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $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_read_timeout 120s;
}
location /ws/relay {
proxy_pass http://127.0.0.1:21119;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $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_read_timeout 120s;
}The full configuration is
server {
server_name YOUR_DOMAIN;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:21114/;
}
location /ws/id {
proxy_pass http://127.0.0.1:21118;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $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_read_timeout 120s;
}
location /ws/relay {
proxy_pass http://127.0.0.1:21119;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $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_read_timeout 120s;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/YOUR_DOMAIN/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/YOUR_DOMAIN/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = YOUR_DOMAIN) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name YOUR_DOMAIN;
listen 80;
return 404; # managed by Certbot
}Note
If you have previously deployed for web clients and want to use it across all platforms, you need to add proxy_read_timeout.
Bypass CORS if using RustDesk public web client https://rustdesk.com/web
You need to add below in the location / section of the /etc/nginx/.../rustdesk.conf to bypass CORS limitation of browsers. Skip this step if you are using your own web client.
if ($http_origin ~* (https?://(www\.)?rustdesk\.com)) {
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
}
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Content-Length' 0;
add_header 'Content-Type' 'text/plain charset=UTF-8';
return 204;
}SELinux
If Waiting for RustDesk Relay service to become active... appears when install, it may be caused by SELinux. You can try the following commands:
sudo semanage fcontext -a -t NetworkManager_dispatcher_exec_t 'hbbs'
sudo semanage fcontext -a -t NetworkManager_dispatcher_exec_t 'hbbr'
sudo restorecon -v '/usr/bin/hbbs'
sudo restorecon -v '/usr/bin/hbbr'阿雪技术观
让我们积极投身于技术共享的浪潮中,不仅仅是作为受益者,更要成为贡献者。无论是分享自己的代码、撰写技术博客,还是参与开源项目的维护和改进,每一个小小的举动都可能成为推动技术进步的巨大力量
Embrace open source and sharing, witness the miracle of technological progress, and enjoy the happy times of humanity! Let's actively join the wave of technology sharing. Not only as beneficiaries, but also as contributors. Whether sharing our own code, writing technical blogs, or participating in the maintenance and improvement of open source projects, every small action may become a huge force driving technological progrss.
相关推荐
-
- 官方网站注册(playstation官方网站注册)
-
要注册快手网站,首先需要下载并安装快手APP,然后选择注册账号。注册时需要填写手机号码并验证,然后设置用户名和密码。在注册过程中还需要设置头像和填写个人信息,确保信息真实有效。注册完成后,可以开始使用快手APP,浏览、上传视频、与其他用户互...
-
2025-12-24 00:03 off999
- 手机照片删除恢复软件免费版
-
手机照片误删怎么办?在我们日常生活中经常会用到截屏或者相机,我们保存有意义的图片的同时也会留下许多垃圾图片,时间长了,再想清理很容易就会误删手机照片,那么手机照片误删该怎么办呢?今天就给大家分享几个找...
- 如何在国内使用gpt(如何在国内使用推特)
-
需要具备以下两个条件,才能使用gpt35国内版:1.购买相关许可证:gpt35国内版是需要购买相应的许可证才能使用的,需要联系属于该软件产品的销售方,获取合法的许可证。2.安装环境的配备:gpt3...
- google加速器(google加速器官网)
-
需要加速器的。手机谷歌浏览器需要加速器。要运行谷歌浏览器还需要在手机上下载安装一个加速器。谷歌浏览器是一款由Google公司开发的网页浏览器,该浏览器基于其他开源软件撰写,包括WebKit,目标是提升...
- windows7下如何分区(win7怎么系统分区)
-
按照以下步骤进行操作:1.确定您的电脑已经安装Windows7操作系统,并且至少有一个硬盘分区。2.打开“计算机管理”工具。在Windows7中,您可以通过打开“开始菜单”,在搜索框中输入“计...
- android windows7下载(安卓安装win7)
-
1、在电脑桌面上找到电脑的控制面板,点击进入控制面板;2、点击控制面板右上角的“查看方式”下拉菜单中选择“类别”选项;3、接着点击“时钟,语言和区域”选项;4、单击语言下方的“添加语言”;5、左键单击...
- 华为路由器设置步骤图解(华为路由器用什么设置)
-
华为路由器设置无线网络方法:【开启路由器的无线功能】1、进入路由器:打开浏览器,在地址栏输入192.168.1.1(一般路由器地址是这个或者查看路由器背面的登录信息)进路由-输入用户名,密码,(默认...
- 怎么恢复已删除文件(怎样恢复已删文件)
-
1、首先打开电脑管家工具箱。找到“文件恢复”工具。2、点击【恢复被删除的文件】并开始恢复3、选择要恢复的文件和目录所在的位置4、耐心等待扫描结果,整个过程受磁盘大小影响5、选择想要恢复的...
-
- 电脑桌面设置密码(电脑桌面设置密码不让别人乱开)
-
第一步点击电脑左下角的开始,选择设置。第二步选择账户。第三步在左侧选择登录选项,点击密码下面的添加,即可创建密码了。在钉钉电脑版中,是不能直接设置桌面密码的。不过,你可以通过设置电脑锁屏来保护个人隐私。具体步骤如下:1.打开电脑的“设...
-
2025-12-23 19:51 off999
- 破解游戏平台(破解游戏平台大全)
-
破解的steamvr游戏,你可以去虎虎VR下载,他们都是免费的。貌似是国外搬运的。是非常有可能会会遭到封禁的,平台不鼓励这种东西,只要一举报马上就会疯。
- 显卡驱动更新不了怎么办(显卡驱动一直更新失败)
-
第一种:解除BIOS限制有些显卡型号会在BIOS上面限制显卡驱动的更新,需要取消其限制才可以更新显卡驱动。第一步:重启电脑,在重启的过程中按住DEL键,进入BIOS界面。第二步:在BIOS界面中,找到...
- win10系统怎么更新到最新版本
-
1、点击打开开始菜单,从左边找到【设置】2、打开设置,点击下面的【更新和恢复】,执行系统更新检查。3、打开Windows更新,点下面的【高级选项】4、进入高级选项找到【选择预览版的安装方式】,更改更新...
- 怎么给u盘单个文件加密(如何对u盘里面的单个文件进行加密)
-
可以使用加密软件对U盘文件进行受控加密,可以加密单个文件,也可以批量加密文件。通过用户身份认证和计算机认证(可选)的双重认证方式,确保只有特定的人员才能使用该U盘。设定密码、密保的最多尝试次数,超过则...
- 怎么换手机密码(怎么换手机密码6位数)
-
1、打开手机主屏幕然后进入【设置】功能;2、然后再选中设置里面进入【密码】;3、之后需要输入一次旧密码进入密码锁定页面;4、然后在密码页面选择【更改密码】功能;5、然后在更改密码页面输入旧密码;6、旧...
欢迎 你 发表评论:
- 一周热门
-
-
抖音上好看的小姐姐,Python给你都下载了
-
全网最简单易懂!495页Python漫画教程,高清PDF版免费下载
-
Python 3.14 的 UUIDv6/v7/v8 上新,别再用 uuid4 () 啦!
-
飞牛NAS部署TVGate Docker项目,实现内网一键转发、代理、jx
-
python入门到脱坑 输入与输出—str()函数
-
宝塔面板如何添加免费waf防火墙?(宝塔面板开启https)
-
Python三目运算基础与进阶_python三目运算符判断三个变量
-
(新版)Python 分布式爬虫与 JS 逆向进阶实战吾爱分享
-
失业程序员复习python笔记——条件与循环
-
系统u盘安装(win11系统u盘安装)
-
- 最近发表
- 标签列表
-
- python计时 (73)
- python安装路径 (56)
- python类型转换 (93)
- python进度条 (67)
- python吧 (67)
- python的for循环 (65)
- python格式化字符串 (61)
- python静态方法 (57)
- python列表切片 (59)
- python面向对象编程 (60)
- python 代码加密 (65)
- python串口编程 (77)
- python封装 (57)
- python写入txt (66)
- python读取文件夹下所有文件 (59)
- python操作mysql数据库 (66)
- python获取列表的长度 (64)
- python接口 (63)
- python调用函数 (57)
- python多态 (60)
- python匿名函数 (59)
- python打印九九乘法表 (65)
- python赋值 (62)
- python异常 (69)
- python元祖 (57)
