前言

本地有台linux主机打算搞个博客但是没有公网所以想用frp穿透实现外网访问

准备工作
  1. 有公网的服务器(未备案域名需要国外服务器)

  2. 域名(本人已备案)

  3. 本地服务器

服务器

Releases · fatedier/frp下载对应系统的版本,服务器请删除frpc相关的文件

  • 编辑frps.toml,配置如下

bindAddr = "0.0.0.0"
bindPort = 7000
vhostHTTPPort = 80
vhostHTTPSPort = 443
auth.method = "token"
auth.token = "xxxx"     #认证token
webServer.addr = "0.0.0.0"
webServer.port = 7500     #后台端口
webServer.user = "xxx"     #后台账号
webServer.password = "xxx"     #后台密码
  • 启动服务端

  • frps -c ./frps.toml

本地服务器
  • 安装1panel面板(方便且占用低)

  • 屏幕截图 2025-07-15 014829.png

  • 应用商店安装frp客户端,token填写上面服务器里设置的token

  • 网站-证书-添加DNS账号-申请证书并且保存到本地(保存位置选择到容器的文件夹),frps 代理https的时候需要证书

  • frpc配置

serverAddr = "xxx.xxx.xxx.xxx" #服务器ip
serverPort = 7000 #服务器端口记得打开端口
auth.method = "token"
auth.token = "xxxxxx" #服务器token

[[proxies]]
name = "qinglong_https"
type = "https"
customDomains = ["ql.981102.xyz"]
[proxies.plugin]
type = "https2http"
localAddr = "0.0.0.0:5700"
crtPath = "/etc/frp/ssl/ql_981102_xyz/fullchain.pem" #证书导出的位置,这边要写容器里的位置
keyPath = "/etc/frp/ssl/ql_981102_xyz/privkey.pem"
hostHeaderRewrite = "0.0.0.0"
requestHeaders.set.x-from-where = "frp"
[[proxies]]
name = "halo_https"
type = "https"
customDomains = ["981102.xyz"]
[proxies.plugin]
type = "https2http"
localAddr = "0.0.0.0:8090"
crtPath = "/etc/frp/ssl/981102_xyz/fullchain.pem"
keyPath = "/etc/frp/ssl/981102_xyz/privkey.pem"
hostHeaderRewrite = "0.0.0.0"
requestHeaders.set.x-from-where = "frp"

配置完后重启frp客户端即可本站便是frp https穿透