服务端
mkdir -p /opt/frp
cd /opt/frp
wget http://vip.123pan.cn/1815238395/download/frp/0.56.0/frp_0.56.0_linux_amd64.tar.gz
tar xzvf frp_0.56.0_linux_amd64.tar.gz
mv frp_0.56.0_linux_amd64/* .
# 增加自启动任务
cat <<EOF>/etc/systemd/system/frps.service
[Unit]
Description=FRP Server Daemon
After=network.target
Wants=network.target
[Service]
Type=simple
ExecStart=/opt/frp/frps -c /opt/frp/frps.toml
Restart=always
RestartSec=20s
User=nobody
LimitNOFILE=infinity
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-relaod
systemctl enable frps
systemctl restart frps
客户端
配置文件
cat <<'EOF'>/opt/frp/frpc.toml
# frpc.toml
serverAddr = "xxx"
serverPort = 7000
[[proxies]]
name = "gogs"
type = "tcp"
localIP = "127.0.0.1"
localPort = 3000
remotePort = 1271
EOF
启动文件
cat <<EOF>/etc/systemd/system/frpc.service
[Unit]
Description=FRP Client Daemon
After=network.target
Wants=network.target
[Service]
Type=simple
ExecStart=/opt/frp/frpc -c /opt/frp/frpc.toml
Restart=always
RestartSec=20s
User=nobody
LimitNOFILE=infinity
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable frpc
systemctl restart frpc