Nginx http反向代理流程Proxy_pass模块

88-90

 

 

 

反向代理代码示列

 server {
        listen    80;
        server_name  shop**.com.cn;

        location /{
                proxy_pass http://test/www;
                proxy_http_version 1.1;
                proxy_set_header Connection "";
                proxy_method POST;
                proxy_pass_request_headers off;
                proxy_pass_request_body off;
                proxy_set_body 'hello world'; #传入包体 通过抓包查看
                proxy_set_header name ''; #将自定义头部 name 置空
        }
        upstream test {
                server 192.168.0.**:8890 weight=1 ;
                #keepalive 32;
                least_conn ;
                zone backends 64k;
        }
    
}        

上游服务器代码示列

server {
                listen 8890;
                return 200 "8890 server respnese.
                uri.$uri
                method:$request_method
                request:$request
                http_name:$http_name
                \n";
}

 

tcpdump -i lo port 8890 -A -s 0 //抓包查看body内容

 

posted on 2019-05-11 13:04  _Jee  阅读(3439)  评论(0编辑  收藏  举报

导航