内网穿透 - 反向代理 - frp 使用指南
2020-03-12 本文已影响0人
Anoyi

基本环境
- 【服务端】公网服务器:CentOS 7
- 【客户端】本机电脑:MacOS
- 【frp】下载地址:https://github.com/fatedier/frp/releases
下面示例将本地服务 http://127.0.0.1:8080/
反向代理到公网 http://<公网IP>:8080/
服务端部署
1、下载「linux-amd64」软件包,示例:
wget https://github.com/fatedier/frp/releases/download/v0.32.0/frp_0.32.0_linux_amd64.tar.gz
2、解压软件包
wget frp_0.32.0_linux_amd64.tar.gz
3、进入目录 frp_0.32.0_linux_amd64
,编辑配置文件 frps.ini
,内容如下:
[common]
bind_port = 7000
auto_token = anoyi
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = admin
[http]
type = tcp
local_ip = 127.0.0.1
local_port = 8080
remote_port = 8080
4、启动服务端
./frps -c frps.ini
5、访问后台,地址:http://<公网IP>:7500

客户端部署
1、下载「darwin_amd64」软件包,示例:
wget https://github.com/fatedier/frp/releases/download/v0.32.0/frp_0.32.0_darwin_amd64.tar.gz
2、解压软件包
tar -zxvf frp_0.32.0_darwin_amd64.tar.gz
3、进入目录 frp_0.32.0_darwin_amd64
,编辑配置文件 frpc.ini
,内容如下:
[common]
server_addr = <公网IP>
server_port = 7000
auto_token = anoyi
[http]
type = tcp
local_ip = 127.0.0.1
local_port = 8080
remote_port = 8080
4、启动服务端
./frpc -c frpc.ini
5、启动本地服务,略
6、访问 http://<公网IP>:8080
,测试连通性