nginx+frp内网穿透

环境:
阿里云服务器:47.105.125.22
内网linux+docker服务器:192.168.56.10
内网windows服务器
1、服务端
nginx配置文件


server  {
  	listen 80;
  	server_name *.wdl.com;
 
  	location / {
  		 
  		root  /home/nginx/html;
  		try_files $uri $uri/ /index.html late;
  		index index.html index.htm;
  		 
		
    
  		add_header 'Access-Control-Allow-Origin' *;  
    		add_header 'Access-Control-Allow-Credentials' 'true';  
    		add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT';  
    		add_header 'Access-Control-Allow-Headers' *;  
    		add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';  
    		if ($request_method = 'OPTIONS') {  
    			return 204;  
         }
	}

    		
    		 location /large-model-frptest/ {
    		 proxy_pass http://47.105.125.22:7001;
		 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;
    		 }
     
		error_page 500 502 503 504 /50x.html;
		location = /50x.html {
			root html;
		}
	}




在阿里云服务器新建一个frp目录,在这个目录下面新建frpc.ini文件夹和docker-compose.yml文件夹
frps.ini文件内容

[common]
bind_addr = 0.0.0.0
bind_port = 7000
vhost_http_port = 7001
privilege_token = wdl@qwe..$test

docker-compose.yml文件内容

version: '3.5'
services:
    frps:
        restart: always
        volumes:
            - './frps.ini:/etc/frp/frps.ini'
        container_name: frps
        image: snowdreamtech/frps:0.39.1
        ports:
            - "7000:7000"
            - "7001:7001"

进上面新建的frp这个目录,执行下面命令启动frp

docker-compose up -d

2、内网服务器linux
新建一个frp目录,在这个目录下新建docker-compose.yml和frps.ini文件夹
frps.ini文件内容

[common]
server_addr = 47.105.125.22
server_port = 7000
privilege_token = wdl@qwe..$04

[httpname]
type = http
local_port = 8085
local_ip = 192.168.56.10
custom_domains = ai.wdl.com

docker-compose.yml文件内容

version: '3.5'
services:
    frps:
        restart: always
        volumes:
            - './frpc.ini:/etc/frp/frpc.ini'
        container_name: frpc
        image: snowdreamtech/frpc:0.39.1
        

进到frp目录下,执行

docker-compose up -d
3、内网windows服务器

下载frpWindows客户端,下载地址,下载Windows的amd版本。

https://github.com/fatedier/frp/releases/tag/v0.39.1

在这里插入图片描述
修改frpc.ini文件

[common]
server_addr = 47.105.125.22
server_port = 7000
privilege_token = wdl@qwe..$test

[httpname1]
type = http
local_port = 8085
local_ip = 127.0.0.1
custom_domains = ai.wdl.com

cmd命令框进到下载的这个frp客服端目录。执行下面命令启动

frpc.exe -c frpc.ini

可以通过 http://ai.wdl.com//large-model-frptest/xxx/xxx

备注,阿里云服务要开放7000端口和7001端口
其他参考
https://www.jianshu.com/p/262cacfb9f9a

https://blog.csdn.net/sinat_14899485/article/details/123015843

https://mp.weixin.qq.com/s?__biz=MjM5NDIzNjYxMg==&mid=2653303609&idx=3&sn=72ac48929b29513ed4ee54e0e331579a&chksm=bd5842928a2fcb842780576fc22552e04019469ae72a4f21967b909827b3d65877f05843b17c&scene=27

http://www.5ityx.com/cate100/318637.html

https://www.jianshu.com/p/6be158cc3685

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值