背景:
某夜玩电脑,无聊,看阿里服务器99元一年,感觉可以买来玩一下,按照网上教程搭建了个博客服务器,结果服务器太弱,内存要爆了。于是想在局域网搭建,在公网访问,于是,继续深入,购买了域名,申请了备案,开工。
过程:
公网端:
-
- 防火墙和阿里云安全组,开启对应端口。
- frp服务端将http和https映射到其他端口,例如vhostHTTPPort = 9080,vhostHTTPSPort = 9443
- 增加网站为反向代理,增加两个公网域名,分别对应80端口,和443端口,443端口开启SSL。
- 服务器网站证书,使用阿里dns来申请。
- 开启https。
- 反向代理地址:http://127.0.0.1:9080
- 重要:反向代理高级菜单里,将http://xxx.xxx.xxx.xxx(局域网ip),替换成https://公网域名
局域网端:
-
- 在路由器设置里,将服务器主机mac绑定到固定ip,xxx.xxx.xxx.xxx。
- 在1panele安装所需app并在防火墙开启对应端口。
- 在服务器主机使用1panel搭建wordpress服务器,域名要填自己的公网域名,端口80,并且无需开启https。
- 在网站域名里增加局域网域名xxx.xxx.xxx.xxx。端口80
- 服务器网站证书,使用阿里dns来申请。
- wordpress的siteurl和home都填局域网ip:http://xxx.xxx.xxx.xxx
- 设置frp内网穿透,增加如下字段:[[proxies]]
name = “web-http”
type = “http”
localIP = “127.0.0.1”
localPort = 80
customDomains = [“公网域名”][[proxies]]
name = “web-https”
type = “https”
localIP = “127.0.0.1”
localPort = 443
customDomains = [“公网域名”]
结论:
网上的资料包括AI提供的帮助是碎片化的,需要自己判断整合才能实现。