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

      

  • 相关阅读:
    是什么意思
    Hql查询
    java的LINQ :Linq4j简明介绍
    Sqlite内存数据库
    ACE中的Proactor介绍和应用实例
    mysql的锁表问题
    消息:'null'为空或不是对象
    FusionChart中引入图类型和数据源方法
    实现FusionChart动态获取数据(二)
    JSP页面解决文件路径方法
  • 原文地址:https://www.cnblogs.com/zipon/p/15184811.html
Copyright © 2011-2022 走看看