zoukankan      html  css  js  c++  java
  • https点对点转发响应示意图

    	curl 			nginx(proxy_connect)			nginx(NAS)
    	 |  					  |							  |
    	 |  					  |							  |
    (1)	 |-- CONNECT 443 -> 	  |							  |
    	 |  					  |							  |
    	 |						  |---- [ TCP connection ]--->|
    	 |  					  |							  |
    	 |  					  |							  |
    (2)  |<- HTTP/1.1 200 --------|							  |
    	 |  					  |							  |
    	 | 建立连接成功 |							  |
    	 |  					  							  |
    	   ========= 内网隧道通讯(依赖组件,我这里使用n2n) =======
    	 |  					    						  |
    	 |  					  							  |
    	 |  					  |							  |
    	 |   [ SSL stream  ]      |							  |
    (3)  |---[ GET / HTTP/1.1] -->|     [ SSL stream ]  	  |
    	 |   [ Host: xxxx.com]    |---  [ GET / HTTP/1.1 ] -->.
    	 |  					  |		[ Host: xxxx.com ]	  |
    	 |  					  |							  |
    	 |  					  |							  |
    	 |  					  |							  |
    	 |  					  |							  |
    	 |  					  |		[ SSL stream ]		  |
    	 |  [ SSL stream ]	  	  |	<--[ HTTP/1.1 200 OK  ]---'
    	 |<--[ HTTP/1.1 200 OK ]--|		[ < html page >    ]  |
    	 |  [ < html page > ]     |							  |
    	 |  					  |							  |
    	 |  					  |							  |
    

     nginx转发配置参考,注意该nginx服务器需要配置hosts指向

    server {
        listen       80;
        server_name  xxx.com www.xxx.com;
        return       301 https://www.xxx.com$request_uri;
    }
    
    server {
        listen      443 ssl;
        server_name  xxx.com;
        return       301 https://www.xxx.com$request_uri;
    
        ssl on;
        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;
    
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;
        ssl_certificate /usr/local/nginx/conf/keys/xxx.com.pem;
        ssl_certificate_key /usr/local/nginx/conf/xxx.com.key;
    }
    
    server {
        listen      443 ssl;
        server_name  www.xxx.com;
        charset utf-8;
    
        error_log /var/log/nginx/xxx.com.error_log info;
        access_log /var/log/nginx/xxx.com.access_log json_log;
    
        allow  all;
        autoindex off;
        concat on;
        concat_max_files 40;
    
        ssl on;
        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;
    
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;
        ssl_certificate /usr/local/nginx/conf/keys/xxx.com.pem;
        ssl_certificate_key /usr/local/nginx/conf/keys/xxx.com.key;
        location / {
            proxy_pass https://www.xxx.com:443;
        }
    }
  • 相关阅读:
    MySQL数据库的创建&删除&选择
    JS实现异步的几种方式
    十种排序算法实例说明总结
    常用的bug管理工具
    Bootstrap+Hbuilder
    从菜鸟的视角看测试!
    安装numpy和matplotlib
    Eclipse在线安装svn
    重新打个招呼
    <USACO09JAN>气象测量/气象牛The Baric Bovineの思路
  • 原文地址:https://www.cnblogs.com/wyxy2005/p/11983960.html
Copyright © 2011-2022 走看看