主要用到的东西有:服务器一台(公网IP)、Nginx、Frps服务端,群辉Frp客户端,群辉自带Nginx
1、服务端Frps配置
[common]
# frp监听的端口,默认是7000,可以改成其他的
bind_port = 7000
# 授权码,请改成更复杂的
token = xxx
#这个token之后在客户端会用到
# frp管理后台端口,请按自己需求更改
dashboard_port = 7500
# frp管理后台用户名和密码,请改成自己的
dashboard_user = xxx
dashboard_pwd = xxx
enable_prometheus = true
# frp日志配置
#log_file = ./frps.log
#log_level = info
#log_max_days = 3
2、服务端Nginx配置
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
#启动的服务
upstream xxx2023{
server 127.0.0.1:9200;
}
server {
listen 80;
server_name ns.xxx.online;
rewrite ^/(.*) https://$server_name/$1 permanent;
}
#
server {
listen 443 ssl;
server_name ns.xxx.com;
ssl_certificate /www/sites/dsm/ssl/xxx.pem;
ssl_certificate_key /www/sites/dsm/ssl/xxx.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
#使用该协议进行配置。
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
charset koi8-r;
#error
location = /50x.html {
root html;
}
location / {
index index.html index.htm index.php;
proxy_pass http://xxx2023;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 100s;
}
}
3、群辉Frp客户端配置
[common]
server_addr = 111.11.111.11 Frp服务端地址
server_port = 7000
token = xxx
login_fail_exit = false --此处填写false表示连接服务器失败后 自动重连而不是退出,建议添加
[dsm]
type = tcp
local_ip = 192.168.1.1 本地IP
local_port = 80
4、群辉自带Nginx配置
评论区