一、安装frp
1、下载压缩包
frp_0.37.1_linux_amd64.tar.gz
2、解压包
tar -zxvf frp_0.37.1_linux_amd64.tar.gz
3、运行服务器端程序
cd frp_*
./frps -c ./frps.ini
# frps.ini
[common]
bind_port = 7000
dashboard_port = 7500
dashboard_user = pascall
dashboard_pwd = pascall
4、运行客户端程序
cd frp_*
./frpc -c ./frpc.ini
# frpc.ini
# x.x.x.x 服务器端外网ip
[common]
server_addr = x.x.x.x
server_port = 7000
admin_addr = 0.0.0.0
admin_port = 7500
admin_user = pascall
admin_pwd = pascall
[http]
type = tcp
local_ip = 192.168.1.14
local_port = 80
remote_port = 80
二、防止frp程序宕机
1、服务器端配置
yum install -y supervisor
vim /etc/supervisord.d/frp.ini
[program:frp]
directory = /root/frp
command=/root/frp/frps -c /root/frp/frps.ini
autostart = true
numprocs=1
process_name=%(program_name)s
user=root
autorestart=true
redirect_stderr=true
stdout_logfile = /root/frp.log
loglevel=info
systemctl enable supervisord
systemctl start supervisord
systemctl status supervisord
2、客户端配置
yum install -y supervisor
vim /etc/supervisord.d/frp.ini
[program:frp]
directory = /root/frp
command=/root/frp/frpc -c /root/frp/frpc.ini
autostart = true
numprocs=1
process_name=%(program_name)s
user=root
autorestart=true
redirect_stderr=true
stdout_logfile = /root/frp.log
loglevel=info
systemctl enable supervisord
systemctl start supervisord
systemctl status supervisord