赞
踩
创建frpc目录:mkdir ~/frp/frpc
下载frp客户端:wget -qO- https://github.91chi.fun/https://github.com//fatedier/frp/releases/download/v0.41.0/frp_0.41.0_darwin_amd64.tar.gz | tar xz --strip 1 -C ~/frp/frpc
# 查看配置文件内容 cat frpc.ini
# 将以下配置
[common]
server_addr = Frps服务器ip
server_port = Frps服务器port
log_file = ~/frp/frpc/log/frpc.log
log_level = info
log_max_days = 3
authentication_timeout = 900
#用于 frpc reload 重载方式配置
admin_addr = 127.0.0.1
admin_port = 7400
admin_user = admin
admin_pwd = 12345678
[test]
type = tcp
local_ip = 内网IP地址
local_port = 内网port
remote_port = 公网port
use_encryption = true
use_compression = true
#!/bin/bash
FRPC_HOME="$HOME/frp/frpc"
client="$FRPC_HOME/frpc"
ini="$FRPC_HOME/frpc.ini"
log="$FRPC_HOME/log"
if [ "$1" = "start" ];then
nohup $client -c $ini > "$log/nohup_frpc.log" 2>&1 &
echo "frpc start success"
elif [ "$1" = "status" ];then
ps aux | grep frpc | grep -v grep | grep -v $1
echo "frpc status success"
elif [ "$1" = "reload" ];then
echo "frpc" `$client reload -c $ini`
elif [ "$1" = "restart" ];then
ps aux | grep frpc | grep -v grep | grep -v $1 | awk '{print $2}' | xargs kill -9
rm -rf "$log/frpc.log"
rm -rf "$log/nohup_frpc.log"
nohup $client -c $ini > "$log/nohup_frpc.log" 2>&1 &
echo "frpc restart success"
elif [ "$1" = "stop" ];then
ps aux | grep frpc | grep -v grep | grep -v $1 | awk '{print $2}' | xargs kill -9
rm -rf "$log/frpc.log"
rm -rf "$log/nohup_frpc.log"
echo "frpc stop success"
else
other_commands="$client $@"
$other_commands
fi
sudo ln -s $HOME/frp/frpc/frpc.sh /usr/local/bin/frpc
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。