关于 frp+nginx实现内网穿透+共用端口

首先  frps  和 frpc  对比

[common]
bind_addr = 0.0.0.0
bind_port = 7000
vhost_http_port = 80
vhost_https_port = 8443
dashboard_port = 7500
dashboard_pwd = admin

[web01]
type = http
auth_token = admin
custom_domains = www.wxqyhcs.com#通过frps所在服务端域名进行访问  

==================================

# [common] is integral section
[common]

server_addr = 139.196.98.33#服务端ip
server_port = 7000#对应frps的端口7000

# Resolve your domain names to [server_addr] so you can use http://web01.yourdomain.com to browse web01 and http://web02.yourdomain.com to browse web02
[web01]
type = http
local_ip = 127.0.0.1
local_port = 8000 #frps通过域名穿透进来,默认访问本地的8000端口
auth_token = admin
custom_domains = www.wxqyhcs.com

www.wxqyhcs.com----->127.0.0.1:8000

============

再看nginx

  server {
        listen       8000;
        server_name  www.wxqyhcs.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location /rzhy/ {
         proxy_pass http://127.0.0.1:8081/rzhy/;
            root   html;
            index  index.html index.htm;
        }     

   location /mrjc/ {
         proxy_pass http://127.0.0.1:8083/mrjc/;
            root   html;
            index  index.html index.htm;
        }

        }
    }

nginx实现 8081   8083两个tomcat共用本地8000

综上所述,连贯起来理解:

frp通过www..com--->内网127.0.0.1:8000--->

根据项目后缀是什么,跳转到对应的项目----nginx  

这里要注意  nginx的serverName  


 

猜你喜欢

转载自blog.csdn.net/ajax_yan/article/details/84776043