注意服务器端的防火墙与安全策略
服务器端,修改frps.ini
[common]
bind_port = 7000
dashboard_port = 7500
token = 12345678
dashboard_user = admin
dashboard_pwd = admin
vhost_http_port = 80
vhost_https_port = 443
运行
./frps -c frps.ini
本地PC端,修改frpc.ini
[common]
server_addr = x.x.x.x
server_port = 7000
token = 12345678
[web]
type = https
local_ip = 127.0.0.1
local_port = 443
remote_port = 443
custom_domains = www.xxxxx.com
运行
frpc -c frpc.ini
服务端后台运行
至此,我们的服务端仅运行在前台,如果Ctrl+C停止或者关闭SSH窗口后,frps均会停止运行,因而我们使用systemctl的方式部署frp服务,systemctl的方式可以避免frp服务总是断开的问题!!!
我们在/lib/systemd/system目录下创建一个文件frps.service
内容如下:
[Unit]
Description=frps service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
#启动服务的命令(此处写你的frps的实际安装目录)
ExecStart=/yourpath/frps -c /yourpath/frps.ini
[Install]
WantedBy=multi-user.target
然后就启动frps
sudo systemctl start frps
再打开自启动
sudo systemctl enable frps
重启应用
sudo systemctl restart frps
停止应用
sudo systemctl stop frps
查看应用的日志
sudo systemctl status frps