{"id":1580,"date":"2022-08-30T18:54:12","date_gmt":"2022-08-30T10:54:12","guid":{"rendered":"http:\/\/diuut.com\/?p=1580"},"modified":"2022-09-18T22:06:09","modified_gmt":"2022-09-18T14:06:09","slug":"%e5%ae%89%e8%a3%85%e6%90%ad%e5%bb%banginx%e4%bb%a3%e7%90%86%e6%9c%8d%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/diuut.com\/?p=1580","title":{"rendered":"\u5b89\u88c5\u642d\u5efaNginx\u6b63\u5411\u4ee3\u7406"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote\"><p>\u9700\u6c42<\/p><cite>A\u670d\u52a1\u5668\u4e0d\u80fd\u8bbf\u95eeC\u670d\u52a1\uff0cB\u670d\u52a1\u5668\u80fd\u8bbf\u95eeC\u670d\u52a1\uff0cA\u9700\u8981\u901a\u8fc7B\u7684\u4ee3\u7406\u6765\u8bbf\u95eeC\u670d\u52a1\u3002<\/cite><\/blockquote>\n\n\n\n<p>\u51c6\u5907\u6587\u4ef6\uff08ng\u5728\u5b98\u7f51\uff0c\u8865\u4e01\u5305\u5728github\u4e0a\u641c\u7684\u5230\uff09\uff1a<br>nginx-1.22.0.tar.gz         #nginx\u5305<br>ngx_http_proxy_connect_module-master.zip        #\u4ee3\u7406\u8865\u4e01\u5305<br><\/p>\n\n\n\n<p>\u63d0\u524d\u5b89\u88c5\u4f9d\u8d56<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nyum install gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel\n<\/pre><\/div>\n\n\n<p>\u5b89\u88c5\u7f16\u8bd1ngxin<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ntar zxvf nginx-1.22.0.tar.gz\n#\u89e3\u538bnginx\u5305\ncd nginx-1.22.0.tar.gz\nunzip ngx_http_proxy_connect_module-master.zip \n#\u89e3\u538b\u4ee3\u7406\u8865\u4e01\u5305\npatch -d \/usr\/local\/nginx-1.22.0\/ -p 1 &lt; \/usr\/local\/nginx-1.22.0\/ngx_http_proxy_connect_module-master\/patch\/proxy_connect_rewrite_102101.patch\n#\u6253\u4e0a\u8865\u4e01\n#\u5b89\u88c5\u8865\u4e01\u7684\u65f6\u5019\u5982\u679c\u6ca1\u6709patch\u547d\u4ee4\u52a0\u4e0a\u5373\u53ef yum -y install patch\n.\/configure  --with-http_realip_module --with-threads --add-module=\/usr\/local\/nginx-1.22.0\/ngx_http_proxy_connect_module-master\n#\u6309\u9700\u914d\u7f6enginx\nmake\n#\u7f16\u8bd1\nmake install\n#\u5b89\u88c5\ncd \/usr\/local\/nginx\/sbin\n<\/pre><\/div>\n\n\n<p>\u5b89\u88c5\u5b8c\u6bd5\u540e\u53bbnginx\u5b89\u88c5\u76ee\u5f55\u4e2d\u914d\u7f6e\u6587\u4ef6\u4e0b\u52a0\u4e0a\u4ee3\u7406\u914d\u7f6e<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ncd \/usr\/local\/nginx\/conf\nvi nginx.conf\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: yaml; title: ; notranslate\" title=\"\">\nserver {\n        listen       8086;\n        resolver 8.8.8.8;\n        proxy_connect;\n        #proxy_connect_allow            443 563;\n                        location \/ {\n                                proxy_pass https:\/\/$host$request_uri;\n                                proxy_buffer_size 64k;\n                                proxy_buffers 32 32k;\n                                proxy_busy_buffers_size 128k;\n\n                                proxy_set_header Content-Type $http_content_type;\n                                proxy_set_header Host $http_host;\n                                proxy_set_header Authorization $http_Authorization;\n                        }\n        }\n    }\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\u52a0\u4e0a\u914d\u7f6e\u540e\u542f\u52a8nginx\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ncd \/usr\/local\/nginx\/sbin\n.\/nginx -t\n#\u68c0\u67e5\u914d\u7f6e\uff0c\u4e3aok\u7684\u8bdd\u5c31\u53ef\u4ee5\u542f\u52a8\n.\/nginx\n#\u542f\u52a8\n<\/pre><\/div>\n\n\n<p>\u542f\u52a8\u6210\u529f\u540e\u67e5\u770b\u7aef\u53e3\u662f\u5426\u5f00\u542f\u4ee3\u7406<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nnetstat -tunlp | grep 8086\n#\u67e5\u770b\u5bf9\u5e94\u7aef\u53e3\u60c5\u51b5\n#\u2193\u6b63\u5e38\u60c5\u51b5\u2193\n#tcp  0   0 0.0.0.0:8086      0.0.0.0:*     LISTEN   3552\/nginx: master\n<\/pre><\/div>\n\n\n<p>\u542f\u52a8\u6b63\u5e38\u540e\u53ef\u4ee5\u5728\u53e6\u4e00\u53f0\u670d\u52a1\u5668\u7528curl\u6307\u4ee4\u8fdb\u884c\u6d4b\u8bd5<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ncurl --proxy &quot;xxx.xxx.xxx.xxx:8086&quot; -v &quot;www.baidu.com&quot;\n#\u54cd\u5e94\u7ed3\u679c\u4e2d\u6709HTTP\/1.1 200 OK\u5373\u4e3a\u4ee3\u7406\u8bbf\u95ee\u6210\u529f\n<\/pre><\/div>\n\n\n<p>\u8fd8\u53ef\u4ee5\u53bb\u4ee3\u7406\u670d\u52a1\u5668ngxin\u65e5\u5fd7\u4e2d\u67e5\u770b\u5230\u5bf9\u5e94\u7684\u4ee3\u7406\u8bbf\u95ee\u8bb0\u5f55<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ncd \/usr\/local\/nginx\/logs\ntail -f access.log\n################\n&#91;30\/Aug\/2022:19:19:26 +0800] &quot;GET HTTP:\/\/www.baidu.com\/ HTTP\/1.1&quot; 200 2443 &quot;-&quot; &quot;curl\/7.29.0&quot;\n<\/pre><\/div>\n\n\n<p>\u6b64\u5904\u914d\u7f6e\u7684\u662f\u901a\u7528\u7684\u95f4\u63a5\u4ee3\u7406\u65b9\u5f0f\uff0c\u95f4\u63a5\u4ee3\u7406\u4e0e\u76f4\u63a5\u4ee3\u7406\u7684\u533a\u522b\u4e0e\u65b9\u6cd5\u53ef\u4ee5\u53c2\u8003\u53e6\u4e00\u7bc7\u6587\u7ae0\uff0c<a href=\"https:\/\/diuut.com\/?p=1522\">\u300aNginx\u8bf7\u6c42\u76f4\u63a5\u4ee3\u7406\u4e0e\u95f4\u63a5\u4ee3\u7406\u914d\u7f6e\u300b<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9700\u6c42 A\u670d\u52a1\u5668\u4e0d\u80fd\u8bbf\u95eeC\u670d\u52a1\uff0cB\u670d\u52a1\u5668\u80fd\u8bbf\u95eeC\u670d\u52a1\uff0cA\u9700\u8981\u901a\u8fc7B\u7684\u4ee3\u7406\u6765\u8bbf\u95eeC\u670d\u52a1\u3002 \u51c6\u5907\u6587\u4ef6\uff08ng\u5728\u5b98\u7f51\uff0c\u8865<span class=\"more-button\"><a href=\"https:\/\/diuut.com\/?p=1580\" class=\"more-link\">view all . . .<span class=\"screen-reader-text\">\u5b89\u88c5\u642d\u5efaNginx\u6b63\u5411\u4ee3\u7406<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":1501,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[48,60],"_links":{"self":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/1580"}],"collection":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1580"}],"version-history":[{"count":9,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/1580\/revisions"}],"predecessor-version":[{"id":1607,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/1580\/revisions\/1607"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/media\/1501"}],"wp:attachment":[{"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1580"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}