背景介绍
之前一直有使用FRP做内网穿透,一般主要用于远程桌面和对外提供http服务进行测试,由于域名备案信息被撤销,原有解析过去的二级域名被拦截了,所以考虑将FRP 服务端部署到一台墙外的服务器上去,搜了一圈没找到之前的部署记录,本次也就只好将安装过程记录备忘了。
安装时间:2023-05-14 15:51
安装
下载最新版本的frp
frp
在GitHub的地址是,
# 进入用户目录
cd /usr/local
# 下载frp 最新版,
wget https://github.com/fatedier/frp/releases/download/v0.48.0/frp_0.48.0_linux_amd64.tar.gz
# 解压
tar -zxvf frp_0.48.0_linux_amd64.tar.gz
配置
打开服务端配置文件
vi /usr/local/frp/frps.ini
参考frps_full.ini
,将服务端配置文件(frps.ini)修改为如下内容
[common]
bind_addr = 0.0.0.0
bind_port = 7000
token = TOKEN_INFO
# udp port to help make udp hole to penetrate nat
bind_udp_port = 7001
# if you want to support virtual host, you must set the http port for listening (optional)
# Note: http port and https port can be same with bind_port
vhost_http_port = 80
vhost_https_port = 443
# console or real logFile path like ./frps.log
log_file = ./frps.log
# set dashboard_addr and dashboard_port to view dashboard of frps
# dashboard_addr's default value is same with bind_addr
# dashboard is available only if dashboard_port is set
dashboard_addr = 0.0.0.0
dashboard_port = 7500
# dashboard user and passwd for basic auth protect
dashboard_user = admin
dashboard_pwd = admin
# dashboard TLS mode
dashboard_tls_mode = false
# authentication_method specifies what authentication method to use authenticate frpc with frps.
# If "token" is specified - token will be read into login message.
# If "oidc" is specified - OIDC (Open ID Connect) token will be issued using OIDC settings. By default, this value is "token".
authentication_method = token
# if subdomain_host is not empty, you can set subdomain when type is http or https in frpc's configure file
# when subdomain is test, the host used by routing is test.frps.com
subdomain_host = lan.dev.trswcm.com
自启动
添加自启动文件
vi /etc/systemd/system/frps.service
输入如下内容:
[Unit]
Description=Frp Server Service
After=network.target
[Service]
Type=simple
User=root
Restart=on-failure
RestartSec=5s
ExecStart=/usr/local/frp/frps -c /usr/local/frp/frps.ini
[Install]
WantedBy=multi-user.target
添加可执行权限
chmod +x /etc/systemd/system/frps.service
注册服务
systemctl enable frps.service
当出现如下提示信息后表示注册成功
[root@VM-0-9-centos systemd]# systemctl enable frps.service
Created symlink from /etc/systemd/system/multi-user.target.wants/frps.service to /etc/systemd/system/frps.service.
启动服务
systemctl daemon-reload
systemctl start frps
启动过程有可能会报错,报错的话,请根据错误提示进行相应调整
查看服务状态
systemctl status frps
出现如下截图所示信息则表示已启动成功:
推荐另一种简单的docker-compose 的方式:
‵‵‵ yaml
version: '3.3'
services:
frps:
restart: always
network_mode: host
volumes:
- './frps.ini:/etc/frp/frps.ini'
container_name: frps
image: snowdreamtech/frps
评论 (0)