utools是一款新一代桌面效率工具平台,内置海量三方开发者的优秀插件。里面就有一款本文要讲的插件。本文不再赘述utool的功能,详细见下文
部署准备
域名:需要一个三级域名泛解析(如:*.ct.wxsnote.cn),备案域名(国内服务器时)或非备案域名(海外服务器时)
域名证书:非必须项目,如果想支持https,那么就需要ssl证书
服务器:一台已经装好宝塔的amd64(x86_64)系统服务器,最好使用CentOS7(本文在该系统中操作,理论上支持安装宝塔面板的Linux系统都支持)
云服务器推荐:https://cloud.xuanling.cn
解析域名
推荐用三级域名做泛解析,记录值填写服务器公网IP地址
![图片[1]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20240124231003135-image.png)
服务器安全组的放行
将需要用到的端口放行,主要依据配置文件中的端口放行。同时要放行ssh,网站协议端口等一切所要用到的端口
如果不懂,直接如图放行全部,除了服务器防火墙,还有运营商的安全组
![图片[2]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/06/20240603212126435-699e48f9a2f247bd0469163b347579e0.png)
部署服务端
编排模板
Docker部署就非常简单,直接编排模板compose部署即可,在使用编排模板时,请先看看后面的内容,镜像的选择,TOKEN设置,其它参数设置,目录路径等提示,
services:
easyipx:
# 直接指定镜像(amd64+4.0.3,根据你的系统修改ARCH)
image: registry.cn-shanghai.aliyuncs.com/yhliu-public/easyipx:amd64-4.0.3 # 请先查看架构
container_name: easyipx
restart: always
network_mode: host
environment:
- TZ=Asia/Shanghai
- PORT=8088 # 通道使用的端口
- TOKEN=your_custom_token # 必须修改为自定义token(如:123456abc)
- TUNNEL_TLS=false # 是否开启通道加密
#- TUNNEL_PEM_FILE=/opt/easyipx/ssl/server.pem # 启用TLS时取消注释并配置
#- TUNNEL_KEY_FILE=/opt/easyipx/ssl/server.key
- HTTP_PORT=6080 # HTTP服务端口
#- HTTPS_PORT=6443 # 启用HTTPS时取消注释,没啥用,除非你没域名,但有IP证书,不用开,宝塔有nginx,我们直接使用域名建站时配置域名证书即可
#- HTTP_PEM_FILE=/opt/easyipx/ssl/http.pem # 启用HTTPS_PORT时取消注释并配置
#- HTTP_KEY_FILE=/opt/easyipx/ssl/http.key # 启用HTTPS_PORT时取消注释并配置
- PORT_RANGE=1024-49151 # 动态端口范围
volumes:
- /www/wwwroot/easyipx/ssl:/opt/easyipx/ssl/ # 证书存储目录(宿主机路径)
services:
easyipx:
# 直接指定镜像(amd64+4.0.3,根据你的系统修改ARCH)
image: registry.cn-shanghai.aliyuncs.com/yhliu-public/easyipx:amd64-4.0.3
container_name: easyipx
restart: always
network_mode: host
environment:
- TZ=Asia/Shanghai
- PORT=8088 # 通道使用的端口
- TOKEN=your_custom_token # 必须修改为自定义token(如:123456abc)
- TUNNEL_TLS=false # 是否开启通道加密
#- TUNNEL_PEM_FILE=/opt/easyipx/ssl/server.pem # 启用TLS时取消注释并配置
#- TUNNEL_KEY_FILE=/opt/easyipx/ssl/server.key
- HTTP_PORT=6080 # HTTP服务端口
#- HTTPS_PORT=6443 # 启用HTTPS时取消注释,没啥用,除非你没域名,但有IP证书,不用开,1Panel有OpenResty,我们直接使用域名建站时配置域名证书即可
#- HTTP_PEM_FILE=/opt/easyipx/ssl/http.pem # 启用HTTPS_PORT时取消注释并配置
#- HTTP_KEY_FILE=/opt/easyipx/ssl/http.key # 启用HTTPS_PORT时取消注释并配置
- PORT_RANGE=1024-49151 # 动态端口范围
volumes:
- /opt/1panel/apps/easyipx/ssl:/opt/easyipx/ssl/ # 证书存储目录(宿主机路径)
关于镜像选择:
在你的云服务器终端中输入以下命令,查看所属架构,然后选择镜像
dpkg --print-architecture
![图片[3]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20251217195428932-image.png)
image是要配置的镜像地址,有三种,依据你服务器架构选择:
| 镜像版本 | 镜像地址 | 镜像描述 |
|---|---|---|
| amd64-4.0.3 | registry.cn-shanghai.aliyuncs.com/yhliu-public/easyipx:amd64-4.0.3 | linux/amd64架构 |
| arm64-4.0.3 | registry.cn-shanghai.aliyuncs.com/yhliu-public/easyipx:arm64-4.0.3 | linux/arm64架构 |
| amd64-3.2.0 | registry.cn-shanghai.aliyuncs.com/yhliu-public/easyipx:amd64-3.2.0 | linux/amd64架构 |
关于TOKEN的填写:
TOKEN建议用一个MD5,md5生成:https://tool.wxsnote.cn/md5/
关于其它参数:
每个参数前需要加-符号
| 参数 | 默认值 | 描述 |
|---|---|---|
| PORT | 8088 | 通道使用的端口,按需修改 |
| TOKEN | your_custom_token | 签名使用的token 不要泄露出去,建议修改 |
| TUNNEL_TLS | false | 是否开启通道加密。如果设置为true 则下面的两个文件必须配置 |
| TUNNEL_PEM_FILE | 与程序本体的相对路径或绝对路径皆可 | |
| TUNNEL_KEY_FILE | 与程序本体的相对路径或绝对路径皆可 | |
| HTTP_PORT | 6080 | http端口,按需修改 |
| HTTPS_PORT | 6443 | https端口,按需修改,请注意,如果是nginx转发的,这里的证书不需要配置,证书配置在nginx上 |
| HTTP_PEM_FILE | https需要的证书, 如果未配置,则https端口不会开通 | |
| HTTP_PEM_FILE | https需要的证书, 如果未配置,则https端口不会开通 | |
| HTTP_KEY_FILE | https需要的证书,如果未配置,则https端口不会开通 | |
| PORT_RANGE | 1024-49151 | 这里的端口范围只是为了方便客户端设置端口,不会全部占用,用到哪个开哪个 |
关于参数中的证书地址填写:
在宝塔中/www/wwwroot/easyipx/ssl目录是你放置ssl证书的位置,而在1panel中/opt/1panel/apps/easyipx/ssl目录是你放置ssl证书的位置
将对应参数所需的证书放在以上提到的目录中,例如将证书放在了/www/wwwroot/easyipx/ssl/wxsnote.cn.pem,那参数中填写/opt/easyipx/ssl/wxsnote.cn.pem
关于反向代理建站:
然后直接新建站点,反向代理http://127.0.0.1:6080即可
在Docker页中的网址里直接创建反向代理,建议二级域名及三级泛解析域名,后续申请该二级和三级泛域名证书
![图片[4]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20251217200249779-image.png)
在网站页创建网站,选择反向代理
![图片[5]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20251217200601561-image.png)
后续你就可以为这些网站添加证书了,所以HTTPS_PORT及其子参数你是不用配置的,直接在反向代理软件添加就好。
检查云服务器系统架构,在ssh终端输入命令检查架构(下图仅示例,因为此图为后补充,本文实际下载的是amd64)
dpkg --print-architecture
![图片[3]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20251217195428932-image.png)
下载服务端软件easyipx:
文末有本站提供的压缩包,不过下面的图还是建议看看
进入下载页面选择最新的版本,V4,也可以看后面的最后修改日期,本文文末提供的可能不是最新版
![图片[7]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20241117184903942-image.png)
x86_64选择amd64
![图片[8]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20241117185033865-a3e87c6cd66e78614516a4f2388ebd1c.png)
下载服务端
![图片[9]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20241117185045827-8e6cb7715cfd217292f26e2f669f9ed5.png)
下载完easyipx,记得下载配置文件,后续要用
![图片[10]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20241117185132267-2ffef63e8ac60015486d938e213db026.png)
在软件商店安装Nginx和进程守护管理器
![图片[11]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20240124231936347-image.png)
在网站添加站点,域名输入一个二级域名(后面会删,占位用的)和一个三级泛解析
ct.wxsnote.cn
*.ct.wxsnote.cn
![图片[12]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20240124232225964-image.png)
删除二级域名,因为用不到
![图片[13]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20240124233452717-image.png)
目标url填写
http://127.0.0.1:6080
![图片[14]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20240124232650566-image.png)
点击反向代理的配置文件,替换为以下内容
#PROXY-START/
location ^~ /
{
proxy_pass http://127.0.0.1:6080; # 反向代理目标地址
proxy_cache off;
proxy_set_header Host $host; # 设置请求头
proxy_set_header X-Real-IP $remote_addr; # 设置真实IP头
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; # 设置转发头
proxy_set_header X-Forwarded-Proto $scheme; # 设置转发协议头
proxy_redirect http://$host/ http://$host:$server_port/;
# 如果需要用到webscoket 则配置上下面的配置,不需要则不必配置。
# proxy_http_version 1.1; 注释或删除关闭
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 7200;
}
#PROXY-END/
![图片[15]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20240124232755301-image.png)
上传下载的程序和程序配置文件,为了方便,
![图片[16]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20240124233330448-image.png)
为程序添加执行权限,输入命令并回车
chmod +x easyipx
![图片[17]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20240124234932858-image.png)
上传或新增conf.json文件,修改配置文件,改token即可,md5生成:https://tool.wxsnote.cn/md5/
{
"addr": "0.0.0.0",
"port": 8088,
"token": "这里换成自己的token, 很重要,不要泄露出去",
"tunnel": {
"tls": false,
"pem_file": "",
"key_file": ""
},
"http": {
"http_port": 6080,
"https_port": 6443,
"pem_file": "",
"key_file": "",
"heartbeat": 30
},
"tcp": {
"buffer_cache": 32768,
"port_range": "1024-49151"
},
"udp": {
"keep_time": 7200,
"health_check": 60,
"buffer_cache": 32768,
"port_range": "1024-49151"
}
}
![图片[18]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20240124234009737-image.png)
在进程守护管理器添加守护进程
运行目录就是程序放置的目录,也就是网站目录
启动命令中的网站目录记得修改
/www/wwwroot/网站目录/easyipx
![图片[19]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20240124234525516-image.png)
检查是否启动成功
![图片[20]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20241117195324834-image.png)
utool电脑端配置内网穿透
安装内网穿透插件
![图片[21]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20240125000127826-image.png)
在内网穿透插件中添加服务器
- 域名填写二级域名
- 主机地址填写服务器公网IP:8088
- 连接token为你在服务端配置文件填写的内容,相当于密码
- http端口填80
- https端口,如果你设置了ssl证书,可以开启,并填写443
![图片[22]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20241117195726266-image.png)
内网穿透应用案例
添加隧道,在本机我的世界开房间,房间局域网提示端口为6666,那么你的朋友就可以输入mc.ct.wxsnote.cn:6666,连接你的房间
![图片[23]-在宝塔搭建utools内网穿透服务将本地服务分享到公网-王先生笔记](https://wxsnote.cn/wp-content/uploads/2024/01/20240125001052667-image.png)
除了游戏,你还可以做其它事,比如
- 将自己建在电脑的网站发布出去
- 开发小程序时,不用部署到服务器,直接连接部署在电脑的小程序
- 将电脑的文件分享到网络
常见问题解答
如何开启ssl证书,使用https?
其它问题,请在评论区提问
2025-12-17 20:25:51,某些文章具有时效性,若有错误或已失效,请在下方留言或加入QQ群:
399019539 联系群主反馈。注意一些链接无法访问可能是你网络的原因,如Github,并非资源地址失效。
登录后可快速点此处反馈,点击登录













请登录后查看评论内容