mirror of https://github.com/stilleshan/frps.git
Compare commits
7 Commits
c29f2bd24c
...
ab182ac07b
Author | SHA1 | Date |
---|---|---|
Stille | ab182ac07b | |
Stille | d747cf3362 | |
Stille | ea5731efe1 | |
Stille | af70f0ee13 | |
shenyunet | 9e6da70896 | |
shenyunet | 2d47c7afd7 | |
shenyunet | 05650ccde0 |
|
@ -1,7 +1,7 @@
|
|||
FROM alpine:3.8
|
||||
LABEL maintainer="Stille <stille@ioiox.com>"
|
||||
|
||||
ENV VERSION 0.51.3
|
||||
ENV VERSION 0.54.0
|
||||
ENV TZ=Asia/Shanghai
|
||||
WORKDIR /
|
||||
|
||||
|
@ -18,10 +18,10 @@ RUN if [ "$(uname -m)" = "x86_64" ]; then export PLATFORM=amd64 ; \
|
|||
&& tar xzf frp_${VERSION}_linux_${PLATFORM}.tar.gz \
|
||||
&& cd frp_${VERSION}_linux_${PLATFORM} \
|
||||
&& mkdir /frp \
|
||||
&& mv frps frps.ini /frp \
|
||||
&& mv frps frps.toml /frp \
|
||||
&& cd .. \
|
||||
&& rm -rf *.tar.gz frp_${VERSION}_linux_${PLATFORM}
|
||||
|
||||
VOLUME /frp
|
||||
|
||||
CMD /frp/frps -c /frp/frps.ini
|
||||
CMD /frp/frps -c /frp/frps.toml
|
||||
|
|
33
README.md
33
README.md
|
@ -7,14 +7,15 @@
|
|||
> *docker image support for X86 and ARM*
|
||||
|
||||
## 更新
|
||||
- **2024-02-25** 更新toml配置文件
|
||||
- **2021-05-31** 更新国内镜像方便使用
|
||||
- **2021-05-31** 更新 Linux 一键安装脚本同时支持 X86 和 ARM
|
||||
- **2021-05-29** 更新从`0.36.2`版本起 docker 镜像同时支持 X86 和 ARM
|
||||
|
||||
## 使用
|
||||
由于 frps 服务端需要配置参数,本脚本为原版 frps.ini ,安装完毕后请自行编辑 frps.ini 配置端口,密码等相关参数并重启服务.同时你也可以 fork 本仓库后自行修改 frps.ini ,在进行一键安装也非常方便.后期也可自行配置 frps.ini 和调整 frps 的版本.
|
||||
由于 frps 服务端需要配置参数,本脚本为原版 frps.toml ,安装完毕后请自行编辑 frps.toml 配置端口,密码等相关参数并重启服务.同时你也可以 fork 本仓库后自行修改 frps.toml ,在进行一键安装也非常方便.后期也可自行配置 frps.toml 和调整 frps 的版本.
|
||||
|
||||
### 一键脚本(先执行脚本,在自行修改 frps.ini 文件.)
|
||||
### 一键脚本(先执行脚本,在自行修改 frps.toml 文件.)
|
||||
安装
|
||||
```shell
|
||||
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_install.sh && chmod +x frps_linux_install.sh && ./frps_linux_install.sh
|
||||
|
@ -24,8 +25,8 @@ wget https://github.ioiox.com/stilleshan/frps/raw/branch/master/frps_linux_insta
|
|||
|
||||
使用
|
||||
```shell
|
||||
vi /usr/local/frp/frps.ini
|
||||
# 修改 frps.ini 配置
|
||||
vi /usr/local/frp/frps.toml
|
||||
# 修改 frps.toml 配置
|
||||
sudo systemctl restart frps
|
||||
# 重启 frps 服务即可生效
|
||||
```
|
||||
|
@ -37,15 +38,15 @@ wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_uninsta
|
|||
wget https://github.ioiox.com/stilleshan/frps/raw/branch/master/frps_linux_uninstall.sh && chmod +x frps_linux_uninstall.sh && ./frps_linux_uninstall.sh
|
||||
```
|
||||
|
||||
### 自定义一键脚本(先 fork 本仓库,在自行修改 frps.ini 文件后执行脚本.)
|
||||
### 自定义一键脚本(先 fork 本仓库,在自行修改 frps.toml 文件后执行脚本.)
|
||||
- 首先 fork 本仓库
|
||||
- 配置 frps.ini
|
||||
- 配置 frps.toml
|
||||
- 修改 frps_linux_install.sh 脚本
|
||||
- 修改脚本链接
|
||||
- Push 仓库到 GitHub
|
||||
|
||||
#### 修改 frps_linux_install.sh 脚本
|
||||
`FRP_VERSION=0.51.3` 可根据原版项目更新自行修改为最新版本.
|
||||
`FRP_VERSION=0.54.0` 可根据原版项目更新自行修改为最新版本.
|
||||
`REPO=stilleshan/frps` 由于 **fork** 到你自己的仓库,需修改`stilleshan`为你的 GitHub 账号ID.
|
||||
|
||||
#### 执行一键脚本
|
||||
|
@ -74,30 +75,30 @@ sudo systemctl stop frps
|
|||
```
|
||||
|
||||
### docker 部署
|
||||
为避免因 **frps.ini** 文件的挂载,格式或者配置的错误导致容器无法正常运行并循环重启.请确保先配置好 **frps.ini** 后在执行启动.
|
||||
为避免因 **frps.toml** 文件的挂载,格式或者配置的错误导致容器无法正常运行并循环重启.请确保先配置好 **frps.toml** 后在执行启动.
|
||||
|
||||
先 **git clone** 本仓库,并正确配置 **frps.ini** 文件.
|
||||
先 **git clone** 本仓库,并正确配置 **frps.toml** 文件.
|
||||
```shell
|
||||
git clone https://github.com/stilleshan/frps
|
||||
# git clone 本仓库
|
||||
git clone https://github.ioiox.com/stilleshan/frps
|
||||
# 国内镜像
|
||||
vi /root/frps/frps.ini
|
||||
# 配置 frps.ini 文件
|
||||
vi /root/frps/frps.toml
|
||||
# 配置 frps.toml 文件
|
||||
```
|
||||
启动容器
|
||||
```shell
|
||||
docker run -d --name=frps --restart=always \
|
||||
--network host \
|
||||
-v /root/frps/frps.ini:/frp/frps.ini \
|
||||
-v /root/frps/frps.toml:/frp/frps.toml \
|
||||
stilleshan/frps
|
||||
```
|
||||
> 以上命令 -v 挂载的目录是以 git clone 本仓库为例,也可以在任意位置手动创建 frps.ini 文件,并修改命令中的挂载路径.
|
||||
> 以上命令 -v 挂载的目录是以 git clone 本仓库为例,也可以在任意位置手动创建 frps.toml 文件,并修改命令中的挂载路径.
|
||||
|
||||
服务运行中修改 **frps.ini** 配置后需重启 **frps** 服务.
|
||||
服务运行中修改 **frps.toml** 配置后需重启 **frps** 服务.
|
||||
```shell
|
||||
vi /root/frps/frps.ini
|
||||
# 修改 frps.ini 配置
|
||||
vi /root/frps/frps.toml
|
||||
# 修改 frps.toml 配置
|
||||
docker restart frps
|
||||
# 重启 frps 容器即可生效
|
||||
```
|
||||
|
|
21
frps.ini
21
frps.ini
|
@ -1,21 +0,0 @@
|
|||
[common]
|
||||
bind_addr = 0.0.0.0
|
||||
bind_port = 7000
|
||||
bind_udp_port = 7001
|
||||
kcp_bind_port = 7000
|
||||
vhost_http_port = 80
|
||||
vhost_https_port = 443
|
||||
dashboard_addr = 0.0.0.0
|
||||
dashboard_port = 7500
|
||||
dashboard_user = admin
|
||||
dashboard_pwd = admin
|
||||
log_file = ./frps.log
|
||||
log_level = info
|
||||
log_max_days = 3
|
||||
disable_log_color = false
|
||||
token = 12345678
|
||||
allow_ports = 2000-3000,3001,3003,4000-50000
|
||||
max_pool_count = 5
|
||||
max_ports_per_client = 0
|
||||
subdomain_host = frps.com
|
||||
tcp_mux = true
|
|
@ -7,7 +7,7 @@ Wants=network.target
|
|||
Type=simple
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
ExecStart=/usr/local/frp/frps -c /usr/local/frp/frps.ini
|
||||
ExecStart=/usr/local/frp/frps -c /usr/local/frp/frps.toml
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,34 @@
|
|||
bindAddr = "0.0.0.0"
|
||||
bindPort = 7000
|
||||
#kcpBindPort = 7000
|
||||
quicBindPort = 7000
|
||||
|
||||
transport.maxPoolCount = 2000
|
||||
transport.tcpMux = true
|
||||
transport.tcpMuxKeepaliveInterval = 60
|
||||
transport.tcpKeepalive = 7200
|
||||
transport.tls.force = false
|
||||
|
||||
webServer.addr = "0.0.0.0"
|
||||
webServer.port = 7500
|
||||
webServer.user = "admin"
|
||||
webServer.password = "admin"
|
||||
webServer.pprofEnable = false
|
||||
|
||||
log.to = "./frps.log"
|
||||
# trace, debug, info, warn, error
|
||||
log.level = "error"
|
||||
log.maxDays = 1
|
||||
log.disablePrintColor = false
|
||||
|
||||
auth.method = "token"
|
||||
auth.token = "12345678"
|
||||
|
||||
# Only allow frpc to bind ports you list. By default, there won't be any limit.
|
||||
allowPorts = [
|
||||
{ start = 1, end = 65535 }
|
||||
]
|
||||
|
||||
maxPortsPerClient = 0
|
||||
udpPacketSize = 1500
|
||||
natholeAnalysisDataReserveHours = 24
|
|
@ -12,22 +12,22 @@ Font="\033[0m"
|
|||
# fonts color
|
||||
|
||||
# variable
|
||||
FRP_VERSION=0.51.3
|
||||
FRP_VERSION=0.54.0
|
||||
REPO=stilleshan/frps
|
||||
WORK_PATH=$(dirname $(readlink -f $0))
|
||||
FRP_NAME=frps
|
||||
FRP_PATH=/usr/local/frp
|
||||
PROXY_URL="https://ghproxy.com/"
|
||||
PROXY_URL="https://mirror.ghproxy.com/"
|
||||
|
||||
# check frps
|
||||
if [ -f "/usr/local/frp/${FRP_NAME}" ] || [ -f "/usr/local/frp/${FRP_NAME}.ini" ] || [ -f "/lib/systemd/system/${FRP_NAME}.service" ];then
|
||||
if [ -f "/usr/local/frp/${FRP_NAME}" ] || [ -f "/usr/local/frp/${FRP_NAME}.toml" ] || [ -f "/lib/systemd/system/${FRP_NAME}.service" ];then
|
||||
echo -e "${Green}=========================================================================${Font}"
|
||||
echo -e "${RedBG}当前已退出脚本.${Font}"
|
||||
echo -e "${Green}检查到服务器已安装${Font} ${Red}${FRP_NAME}${Font}"
|
||||
echo -e "${Green}请手动确认和删除${Font} ${Red}/usr/local/frp/${Font} ${Green}目录下的${Font} ${Red}${FRP_NAME}${Font} ${Green}和${Font} ${Red}/${FRP_NAME}.ini${Font} ${Green}文件以及${Font} ${Red}/lib/systemd/system/${FRP_NAME}.service${Font} ${Green}文件,再次执行本脚本.${Font}"
|
||||
echo -e "${Green}请手动确认和删除${Font} ${Red}/usr/local/frp/${Font} ${Green}目录下的${Font} ${Red}${FRP_NAME}${Font} ${Green}和${Font} ${Red}/${FRP_NAME}.toml${Font} ${Green}文件以及${Font} ${Red}/lib/systemd/system/${FRP_NAME}.service${Font} ${Green}文件,再次执行本脚本.${Font}"
|
||||
echo -e "${Green}参考命令如下:${Font}"
|
||||
echo -e "${Red}rm -rf /usr/local/frp/${FRP_NAME}${Font}"
|
||||
echo -e "${Red}rm -rf /usr/local/frp/${FRP_NAME}.ini${Font}"
|
||||
echo -e "${Red}rm -rf /usr/local/frp/${FRP_NAME}.toml${Font}"
|
||||
echo -e "${Red}rm -rf /lib/systemd/system/${FRP_NAME}.service${Font}"
|
||||
echo -e "${Green}=========================================================================${Font}"
|
||||
exit 2
|
||||
|
@ -75,21 +75,21 @@ FILE_NAME=frp_${FRP_VERSION}_linux_${PLATFORM}
|
|||
# download
|
||||
if [ $GOOGLE_HTTP_CODE == "200" ]; then
|
||||
wget -P ${WORK_PATH} https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/${FILE_NAME}.tar.gz -O ${FILE_NAME}.tar.gz
|
||||
wget -P ${WORK_PATH} https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.ini -O ${FRP_NAME}.ini
|
||||
wget -P ${WORK_PATH} https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.toml -O ${FRP_NAME}.toml
|
||||
else
|
||||
if [ $PROXY_HTTP_CODE == "200" ]; then
|
||||
wget -P ${WORK_PATH} ${PROXY_URL}https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/${FILE_NAME}.tar.gz -O ${FILE_NAME}.tar.gz
|
||||
wget -P ${WORK_PATH} ${PROXY_URL}https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.ini -O ${FRP_NAME}.ini
|
||||
wget -P ${WORK_PATH} ${PROXY_URL}https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.toml -O ${FRP_NAME}.toml
|
||||
else
|
||||
echo -e "${Red}检测 GitHub Proxy 代理失效 开始使用官方地址下载${Font}"
|
||||
wget -P ${WORK_PATH} https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/${FILE_NAME}.tar.gz -O ${FILE_NAME}.tar.gz
|
||||
wget -P ${WORK_PATH} https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.ini -O ${FRP_NAME}.ini
|
||||
wget -P ${WORK_PATH} https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.toml -O ${FRP_NAME}.toml
|
||||
fi
|
||||
fi
|
||||
tar -zxvf ${FILE_NAME}.tar.gz
|
||||
mkdir -p ${FRP_PATH}
|
||||
mv ${FILE_NAME}/${FRP_NAME} ${FRP_PATH}
|
||||
mv ${FRP_NAME}.ini ${FRP_PATH}
|
||||
mv ${FRP_NAME}.toml ${FRP_PATH}
|
||||
|
||||
# 配置 frps.service
|
||||
cat >/lib/systemd/system/frps.service <<'EOF'
|
||||
|
@ -102,7 +102,7 @@ Wants=network.target
|
|||
Type=simple
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
ExecStart=/usr/local/frp/frps -c /usr/local/frp/frps.ini
|
||||
ExecStart=/usr/local/frp/frps -c /usr/local/frp/frps.toml
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -117,8 +117,8 @@ sudo systemctl enable ${FRP_NAME}
|
|||
rm -rf ${WORK_PATH}/${FILE_NAME}.tar.gz ${WORK_PATH}/${FILE_NAME} ${FRP_NAME}_linux_install.sh
|
||||
|
||||
echo -e "${Green}====================================================================${Font}"
|
||||
echo -e "${Green}安装成功,请先修改 ${FRP_NAME}.ini 文件,确保格式及配置正确无误!${Font}"
|
||||
echo -e "${Red}vi /usr/local/frp/${FRP_NAME}.ini${Font}"
|
||||
echo -e "${Green}安装成功,请先修改 ${FRP_NAME}.toml 文件,确保格式及配置正确无误!${Font}"
|
||||
echo -e "${Red}vi /usr/local/frp/${FRP_NAME}.toml${Font}"
|
||||
echo -e "${Green}修改完毕后执行以下命令重启服务:${Font}"
|
||||
echo -e "${Red}sudo systemctl restart ${FRP_NAME}${Font}"
|
||||
echo -e "${Green}====================================================================${Font}"
|
||||
|
|
|
@ -14,7 +14,7 @@ Font="\033[0m"
|
|||
# variable
|
||||
WORK_PATH=$(dirname $(readlink -f $0))
|
||||
FRP_NAME=frps
|
||||
FRP_VERSION=0.51.3
|
||||
FRP_VERSION=0.54.0
|
||||
FRP_PATH=/usr/local/frp
|
||||
|
||||
# 停止frpc
|
||||
|
|
Loading…
Reference in New Issue