zoukankan      html  css  js  c++  java
  • nginx 配置http和https代理

    https代理关键字connect

    依赖ngx_http_proxy_connect_module 阿里封装的这个模块

    https://github.com/chobits/ngx_http_proxy_connect_module#select-patch 下载对应版本

    安装ngx_http_proxy_connect_module

    1、git clone https://github.com/chobits/ngx_http_proxy_connect_module.git

    2、https://github.com/chobits/ngx_http_proxy_connect_module#select-patch 下载对应版本

    3、cd nginx目录,patch -p1 < patch文件路径

    4、

    ./configure --add-module=/path/to/ngx_http_proxy_connect_module
    make && make install

    完整可运行例子

    wget http://nginx.org/download/nginx-1.18.0.tar.gz
    tar -xvf nginx-1.18.0.tar.gz
    cd nginx-1.18.0/
    patch -p1 < /home/qatools/ngx_http_proxy_connect_module/patch/proxy_connect_rewrite_1018.patch
    
    #patching file src/http/ngx_http_core_module.c
    #patching file src/http/ngx_http_parse.c
    #patching file src/http/ngx_http_request.c
    #patching file src/http/ngx_http_request.h
    #patching file src/http/ngx_http_variables.c
    
    ./configure  --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-threads --add-module=/home/qatools/ngx_http_proxy_connect_module
    
    make 
    make install

     https://blog.csdn.net/yunqiinsight/article/details/93467393

    简单的http代理,配置文件
     
    server {
        resolver 114.114.114.114;
        listen 9999;
        access_log /var/log/nginx/http_proxy.access.log main;
        error_log /var/log/nginx/http_proxy.error.log;
     
        location / {
            proxy_pass $scheme://$http_host$request_uri;
        }
    }
    https/http代理配置文件
     
    server {
        resolver 114.114.114.114;
        listen 9999;
     
        proxy_connect;
        proxy_connect_allow            443 563;
        proxy_connect_connect_timeout  10s;
        proxy_connect_read_timeout     10s;
        proxy_connect_send_timeout     10s;
     
        access_log /var/log/nginx/http_proxy.access.log main;
        error_log /var/log/nginx/http_proxy.error.log;
     
        location / {
            proxy_pass $scheme://$http_host$request_uri;
        }
    }
    

      

  • 相关阅读:
    HTML学习笔记之二(回到顶部 与 回究竟部)
    初次使用cocoapods注意事项
    struts2在web.xml中配置详情
    hdu 3631 Shortest Path(Floyd)
    bullet HashMap 内存紧密的哈希表
    论文摘抄
    oracle中从指定日期中获取月份或者部分数据
    漫谈机器学习经典算法—特征提取与特征选择
    为什么NULL能多次free
    栈的效率为什么比堆高?
  • 原文地址:https://www.cnblogs.com/zipon/p/15184811.html
Copyright © 2011-2022 走看看