大家好,又见面了,我是你们的朋友全栈君。
安装步骤省略(下载解压拷贝到server服务器和client服务器完事)具体移步:github
服务端配置文件:frps.ini
[common]
bind_port = 7777
authentication_method = token
token = 12345678
tls_only = true
kcp_bind_port = 7777
max_pool_count = 10
log_file = /path/to/frp/frps.log
### trace, debug, info, warn, error
log_level = error
log_max_days = 3
# allow_ports = 1,4-5
vhost_http_port = 80
vhost_https_port = 443
dashboard_port = 10
dashboard_user = admin
dashboard_pwd = 12345678
客户端配置文件:frpc.ini
[common]
server_addr = 8.8.8.8
server_port = 7777
tls_enable = true
token = 12345678
protocol = kcp
# pool_count = 5
log_file = /root/frp/frpc.log
log_level = trace
log_max_days = 3
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 1
[http:test]
type = http
local_ip = 127.0.0.1
local_port = 80
custom_domains = test.top
proxy_protocol_version = v2
[https:test]
type = https
local_port = 443
custom_domains = test.top
proxy_protocol_version = v2
use_encryption = true
use_compression = true
#plugin = https2http
#plugin_local_addr = 127.0.0.1:80
#plugin_crt_path = /path/to/test.pem
#plugin_key_path = /path/to/test.key
#plugin_host_header_rewrite = test.top
#plugin_header_X-From-Where = frp
服务端开机自启动
# 添加系统服务
sudo vim /lib/systemd/system/frps.service
# 服务内容
[Unit]
Description=frps service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
ExecStart=/path/to/frp/frps -c /path/to/frp/frps.ini
[Install]
WantedBy=multi-user.target
# 启动
sudo systemctl start frps
# 开机启动
sudo systemctl enable frps
# 其它命令
sudo systemctl restart frps
sudo systemctl stop frps
sudo systemctl status frps
客户端开机自启动
# 添加系统服务
sudo vim /lib/systemd/system/frpc.service
# 服务内容
[Unit]
Description=frpc service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
ExecStart=/path/to/frp/frpc -c /path/to/frp/frpc.ini
[Install]
WantedBy=multi-user.target
# 启动
sudo systemctl start frpc
# 开机启动
sudo systemctl enable frpc
# 其它命令
sudo systemctl restart frpc
sudo systemctl stop frpc
sudo systemctl status frpc
定时任务,每天定时重启server和client
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/194445.html原文链接:https://javaforall.cn
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有