开始下载
SSH连上你的Linux外网服务器下载frp文件,一般Linux 64位的都是下载这个frp_0.34.0_linux_amd64.tar.gz
#Linux 32位系统 wget https://github.com/fatedier/frp/releases/download/v0.34.0/frp_0.34.0_linux_386.tar.gz #Linux 64位系统 wget https://github.com/fatedier/frp/releases/download/v0.34.0/frp_0.34.0_linux_amd64.tar.gz #Mac系统 wget https://github.com/fatedier/frp/releases/download/v0.34.0/frp_0.34.0_darwin_amd64.tar.gz #
![「代码发布」CentOS 7 环境下配置FRP服务后台自启插图 「代码发布」CentOS 7 环境下配置FRP服务后台自启插图](https://static.esw.eswlnk.com/2022/08/20220815030549951.png-esw)
解压tar.gz文件
tar -zxvf frp_0.34.0_linux_amd64.tar.gz
进入解压好的目录
cd frp_0.34.0_linux_amd64
服务端配置的文件是frps.ini
[common]
#系统端口
bind_port = 7000
#web端访问的端口如:test1.zuigao.com:80
vhost_http_port = 80
[web]
type = http
custom_domains = test1.zuigao.com
auth_token = 123456
客户端设置
客户端根据你的系统,下载上面对应的frp文件,操作方法是一样的,只是配置的文件不同,客户端操作的文件是frpc.ini
[common]
server_addr = test1.zuigao.com
server_port = 7000
auth_token = 123456
[web]
type = http
#本地服务的端口
local_port = 8080
custom_domains = test1.zuigao.com
启动服务器端frp
进入服务器frp的安装包文件夹,执行命令
./frps -c ./frps.ini
启动客户端frp
./frpc.exe -c ./frpc.ini
其他方法
使用 systemctl 来控制启动,在 frps.service 里写入以下内容:
vi /lib/systemd/system/frps.service
[Unit]
Description=frps service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
#启动服务的命令(此处写你的frps的实际安装目录)
ExecStart=/test/frp_0.20.0/frps -c /test/frp_0.20.0/frps.ini
[Install]
WantedBy=multi-user.target
相关命令
systemctl start frps //启动frps
systemctl stop frps //停止应用
systemctl restart frps //重启frps
systemctl enable frps //打开自启动
systemctl disable frps //关闭开机自启动
systemctl status frps //查看应用的日志
📮评论