最近犹豫疫情问题,公司推迟上班了,但是要远程办公。很多小伙伴家里有电脑但是公司没人公司电脑开不了机,所以为了方便,就把公司内网的svn服务器用frp内网穿透映射到外网来,这样就可以开始干活了。
前提:Nginx转发SVN,内网可以使用 http://xxx.com
访问svn
1. 安装frp
这里用frp内网穿透,服务器和客户端的搭建参考之前写的文件frp内网穿透搭建远程桌面
2. 为了安全,使用https协议
先准备一个域名,然后可以去阿里云申请一个免费的ssl证书。这里需要证书的*.key和*_public.crt文件,重命名为server.key和server.crt放到frp客户端目录下
3. 服务器配置,加入https端口配置 vhostHTTPSPort = 443
# 服务器端口
bindPort = 7000
# http(s)端口
vhostHTTPPort = 80
vhostHTTPSPort = 443
# 权限认证
auth.method = "token"
auth.token = "123456"
4. 客户端配置
客户端用frp的https2http插件启用https
# 服务器域名端口
serverAddr = "服务器域名或公网IP"
serverPort = 7000
# 权限认证
auth.method = "token"
auth.token = "123455"
[[proxies]]
name = "SVN"
type = "https"
customDomains = ["xxx.com"]
[proxies.plugin]
type = "https2http"
localAddr = "127.0.0.1:80"
crtPath = "./server.crt"
keyPath = "./server.key"
hostHeaderRewrite = "127.0.0.1"
requestHeaders.set.x-from-where = "frp"
5. 测试
重新frp服务器和客户端。然后在电脑上用svn直接clone地址是 https://xxx.com/原内网的svn地址
评论区