最近犹豫疫情问题,公司推迟上班了,但是要远程办公。很多小伙伴家里有电脑但是公司没人公司电脑开不了机,所以为了方便,就把公司内网的svn服务器用frp内网穿透映射到外网来,这样就可以开始干活了。

1. 安装frp

这里用frp内网穿透,服务器和客户端的搭建参考之前写的文件frp内网穿透搭建远程桌面

2. 为了安全,使用https协议

先准备一个域名,然后可以去阿里云申请一个免费的ssl证书。这里需要证书的*.key和*_public.crt文件,重命名为server.key和server.crt放到frp客户端目录下

3. 服务器配置,加入https端口配置 vhost_https_port = 443

[common]
bind_port = 7000
vhost_http_port = 80
vhost_https_port = 443

4. 客户端配置

客户端用frp的https2http插件启用https

[common]
server_addr=服务器的IP
server_port=7000

[SVN]
type = https
custom_domains = xxx.com

plugin = https2http
plugin_local_addr = 127.0.0.1:80

# HTTPS 证书相关的配置
plugin_crt_path = ./server.crt
plugin_key_path = ./server.key
plugin_host_header_rewrite = 127.0.0.1
plugin_header_X-From-Where = frp

5. 测试

重新frp服务器和客户端。然后在电脑上用svn直接clone地址是 https://xxx.com/原内网的svn地址