518 字
3 分钟
NAS之搭建frp内网穿透服务过程记录
从渠道那里买了台群晖DS920+做NAS,因为支持docker,就想着把GitServer部署到自己的NAS上,省的Github哪天访问不了,或者Gitee把我代码给和谐了(当然我的代码都是健康绿色的)。因为我的NAS是4G内存的,安装GitLab资源占用会比较高,所以选了比较轻量级的Gitea。
使用 Docker 部署 frpc(客户端)
docker run --network host -d -v /volume1/docker/frp/frpc.ini:/etc/frp/frpc.ini --name frpc snowdreamtech/frpc唯一需要注意的点:配置文件要映射到宿主机,这里是在群晖NAS上部署的,在 NAS 上执行命令部署的时候要注意文件路径需要加上储存池名,也就是volume1,在文件管理里面是不展示该层级的,如果不加则会找不到该文件夹。
在 Ubuntu 上部署 frpc(客户端)
- 下载压缩包
wget https://github.com/fatedier/frp/releases/download/v0.43.0/frp_0.43.0_linux_amd64.tar.gz- 解压压缩包
tar zxvf frp_0.43.0_linux_amd64.tar.gz- 执行
cd zxvf frp_0.43.0_linux_amd64sudo ./frpc -c ./frpc.inifrpc.ini是客户端配置文件,需要进行修改以匹配frps(服务端)
样例:
[common]# 服务端地址,需要可以直接填写IP,需要服务端开启对应端口,例如7257server_addr = xxxxxxx.cnserver_port = 7257# console or real logFile path like ./frpc.loglog_file = ./frpc.log
# trace, debug, info, warn, errorlog_level = infolog_max_days = 3
# disable log colors when log_file is console, default is falsedisable_log_color = false
# for authentication, should be same as your frps.ini# authenticate_heartbeats specifies whether to include authentication token in heartbeats sent to frps. By default, this value is false.authenticate_heartbeats = false
# authenticate_new_work_conns specifies whether to include authentication token in new work connections sent to frps. By default, this value is false.authenticate_new_work_conns = false
# auth token 客户端和服务端需要一致token = xxxxxxxxxxxxxx
# Resolve your domain names to [server_addr] so you can use http://web01.yourdomain.com to browse web01 and http://web02.yourdomain.com to browse web02[gitea]type = httplocal_ip = 127.0.0.1local_port = 23000use_encryption = falseuse_compression = true# if domain for frps is frps.com, then you can access [web01] proxy by URL http://web01.frps.comcustom_domains = xxxxx.cn- 使用 pm2 守护进程
pm2 start "./frpc -c ./frpc.ini" -n frpcpm2 save如果仅仅是部署,没有代理应用的话,是没有输出日志的,但是可以在 frps 服务端看到客户端连接信息。
