1.修改frps配置文件
[common]
bind_port = 7000
token = *******
vhost_http_port = 1780
vhost_https_port = 17443
subdomain_host=test.test.com
dashboard_user = ********
dashboard_pwd = ******
dashboard_port = 7500
2.添加frp的nginx配置
server {
listen 80;
server_name *.test.test.com;
location / {
proxy_pass http://127.0.0.1:1780;
proxy_redirect http://$host/ http://$http_host/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
# return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name b.test.test.com;
ssl_certificate /www/frp/cert/a.test.test.com_bundle.crt;
ssl_certificate_key /www/frp/cert/a.test.test.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
ssl_prefer_server_ciphers on;
proxy_set_header Host $host;
proxy_set_header X-Forwarder-For $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
location / {
proxy_pass http://127.0.0.1:1780;
}
}
# 可以配置多个server
server {
listen 443 ssl;
server_name a.test.test.com;
ssl_certificate /www/frp/cert/b.test.test.com.crt;
ssl_certificate_key /www/frp/cert/b.test.test.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
ssl_prefer_server_ciphers on;
proxy_set_header Host $host;
proxy_set_header X-Forwarder-For $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
location / {
proxy_pass http://127.0.0.1:1780;
}
}
3.nginx添加配置
include /www/frp/frps.nginx.conf;
4.客户端配置
[common]
server_addr = test.test.com
server_port = 7000
token = ********
[test1]
type = http
local_ip = 127.0.0.1
local_port = 8848
subdomain = nacos
[test2]
type = http
local_ip = 127.0.0.1
local_port = 35080
subdomain = bt
[test3]
type = tcp
local_ip = 127.0.0.1
local_port = 3306
remote_port = 9200
subdomain = mysql
[test4]
type = tcp
local_ip = 127.0.0.1
local_port = 6379
remote_port = 9300
subdomain = redis
[test5]
type = http
local_ip = 127.0.0.1
local_port = 80
subdomain = jn
[test-ssh]
type = https
local_ip = 127.0.0.1
local_port = 80
subdomain = shige
5.测试