• 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;
        }
    }
    

      

  • 相关阅读:
    几道算法题及学java心得
    css入门
    关于 移动端整屏切换专题 效果的思考
    css3实现卡牌旋转与物体发光效果
    九方格抽奖插件
    绑定弹窗事件最好的方法,原生JS和JQuery方法
    整屏滚动效果 jquery.fullPage.js插件+CSS3实现
    自定义 页面滚动条
    有趣的HTML5 CSS3效果
    CSS3 过渡与动画
  • 原文地址:https://www.cnblogs.com/zipon/p/15184811.html
Copyright © 2020-2023  润新知