服务器端准备工作:
!!!注意事项:把以下VPS的IP、域名更换成你自己的。
1、一台固定IP的VPS
2、下载系统对应版本的frp
wget https://github.com/fatedier/frp/releases/download/v0.49.0/frp_0.49.0_linux_amd64.tar.gz
解压 frp_0.49.0_linux_amd64.tar.gz
tar -zxvf frp_0.49.0_linux_amd64.tar.gz
重命名 mv frp_0.49.0_linux_amd64 frps
进入frps目录修改 frps.ini为以下内容:
# [common] is integral section
[common]
# A literal address or host name for IPv6 must be enclosed
# in square brackets, as in "[::1]:80", "[ipv6-host]:http" or "[ipv6-host%zone]:80"
bind_addr = 0.0.0.0
bind_port = 5443
# udp port used for kcp protocol, it can be same with 'bind_port'
# if not set, kcp is disabled in frps
kcp_bind_port = 5443
# if you want to configure or reload frps by dashboard, dashboard_port must be set
dashboard_port = 6443
# dashboard assets directory(only for debug mode)
dashboard_user = admin
dashboard_pwd = admin
# assets_dir = ./static
vhost_http_port = 8080
vhost_https_port = 4433
# console or real logFile path like ./frps.log
log_file = ./frps.log
# debug, info, warn, error
log_level = info
log_max_days = 3
# auth token
token = FCaH0YOVts7RDo7U
# It is convenient to use subdomain configure for http、https type when many people use one frps server together.
subdomain_host = 104.128.93.62 #(自己的vpsIP地址)
# only allow frpc to bind ports you list, if you set nothing, there won't be any limit
#allow_ports = 1-65535
# pool_count in each proxy will change to max_pool_count if they exceed the maximum value
max_pool_count = 50
# if tcp stream multiplexing is used, default is true
tcp_mux = true
3、防火墙放行5443、6443、8080、4433端口
4、新建frps服务并设置开机启动
vim /usr/lib/systemd/system/frps.service
进入编辑模式粘贴一下内容:
[Unit]
Description=frps service
After=network.target network-online.target syslog.target
Wants=network.target network-online.target
[Service]
Type=simple
ExecStart=/root/frps/frps -c /root/frps/frps.ini
[Install]
WantedBy=multi-user.target
设置开机启动并启动服务
systemctl enable frps.service
systemctl start frps.service
客户端准备工作:
1、下载frp
https://github.com/fatedier/frp/releases/download/v0.47.0/frp_0.47.0_windows_amd64.zip
解压 frp_0.47.0_windows_amd64.zip
进入frp_0.47.0_windows_amd64目录
2、修改 frpc.ini 为一下内容:
[common]
server_addr = 104.128.93.62
server_port = 5443
token = FCaH0YOVts7RDo7U
[WEB]
type = http
local_ip = 127.0.0.1
local_port = 8080
remote_port = 8080
#custom_domains = web.thinkworld.net #如果想使用域名访问,取消前面的注释,解析你的域名到你的VPS.
3、启动 frpc
cmd 下运行 frpc -c frpc.ini
下载安装tomcat进行测试(需要提前安装JDK)
JDK下载地址:https://download.oracle.com/java/17/archive/jdk-17.0.7_windows-x64_bin.exe
tomcat下载地址:https://dlcdn.apache.org/tomcat/tomcat-10/v10.1.9/bin/apache-tomcat-10.1.9.exe