利用腾讯轻量服务器搭建 FRP 服务

2021-01-25 09:29:54 +08:00
 accgcc233

在如今这个 IPV4 缺乏的年代,家庭宽带获取到公网 IPV4 相对比较困难,特别是移动用户,基本上就是默认不给公网 IPV4,这时候,如果我们想要把内网的资源映射到公网上去,可能会需要用到内网穿透。而 FRP 就是提供这种服务的一种工具废话少说,现在开始进入正题。

  1. 腾讯轻量服务器购买 对于预算较低的用户,香港地区 24 的轻量还是非常推荐的

这边我们选择系统镜像,我们以 centos8 为例。 2. 在腾讯云防火墙开启相应端口(以映射 web 服务为例,开启 80 端口,默认已经开启)

  1. 远程登录服务器,下载源码(以最新版为例) https://github.com/fatedier/frp/releases/download/v0.35.0/frp_0.35.0_linux_amd64.tar.gz

  2. 解压并写配置文件

并按照配置要求开放防火墙端口(此处为 7000 ) 5. 设置开机启动 添加 systemd 配置文件: vim /usr/lib/systemd/system/frp.service 文件内容如下:

[Unit] Description=The nginx HTTP and reverse proxy server After=network.target remote-fs.target nss-lookup.target

[Service] Type=simple ExecStart=/usr/local/frp/frps -c /usr/local/frp/frps.ini KillSignal=SIGQUIT TimeoutStopSec=5 KillMode=process PrivateTmp=true StandardOutput=syslog StandardError=inherit

[Install] WantedBy=multi-user.target ExecStart 的内容请根据自己 frp 安装目录修改。

设置开机启动 systemctl daemon-reload systemctl enable frp 启动 frp systemctl start frp 查看 frp 是否启动 ps aux | grep frps 6. 客户端配置 [common] server_addr = 服务器 IP server_port = 7000

[http] type = tcp local_ip = 本机 IP local_port = 80 remote_port = 80 7. 配置完成,尽情享用

491 次点击
所在节点    VPS
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/748022

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX