{"id":3771,"date":"2019-01-22T17:32:48","date_gmt":"2019-01-22T09:32:48","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=3771"},"modified":"2019-01-22T17:32:48","modified_gmt":"2019-01-22T09:32:48","slug":"%e4%b8%80%e6%ac%a1%e7%94%9f%e4%ba%a7%e4%ba%8b%e6%95%85%e8%ae%a9%e6%88%91%e5%ad%a6%e4%bc%9a%e4%ba%86-nginx-%e9%99%90%e9%80%9f","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=3771","title":{"rendered":"\u4e00\u6b21\u751f\u4ea7\u4e8b\u6545\u8ba9\u6211\u5b66\u4f1a\u4e86 Nginx \u9650\u901f"},"content":{"rendered":"<p>\n\t\u524d\u65b9\u7684\u8def\u90fd\u662f\u5751\uff0c\u53ea\u6709\u4f60\u8e29\u8fc7\uff0c\u4f60\u624d\u77e5\u9053\uff0c\u7ecf\u9a8c\u5c31\u662f\u94b1\u3002\u522b\u95ee\u516c\u53f8\u91cc\uff0c\u540c\u6837\u6572\u7684\u4ee3\u7801\uff0c\u4e3a\u5565\u522b\u4eba\u6bd4\u4f60\u5de5\u8d44\u9ad8\uff0c\u56e0\u4e3a\u522b\u4eba\u8e29\u7684\u5751\u6bd4\u4f60\u591a\u3002\n<\/p>\n<p>\n\t\u6700\u8fd1\uff0c\u6211\u4eec\u751f\u4ea7\u670d\u52a1\u5668\u5c31\u51fa\u4e86\u4e00\u6b21\u6545\u969c\u3002\u8fd9\u4e2a\u6545\u969c\u672c\u6765\u662f\u4e00\u4e2a\u5c0f\u95ee\u9898\uff0c\u4f46\u662f\u8feb\u4e8e\u6211\u4eec\u6ca1\u6709\u8fd0\u7ef4\uff0c\u5c31\u53ea\u80fd\u6211\u4eec\u786c\u7740\u5934\u76ae\u53bb\u81ea\u5df1\u7814\u7a76\u6478\u7d22\u3002\u6700\u7ec8\u53d1\u73b0\u4e86\u95ee\u9898\u5e76\u89e3\u51b3\u4e86\u5b83\uff0c\u5b83\u5c31\u662f\u4e00\u4e2a\u7b80\u5355\u7684 Nginx \u9650\u901f\u95ee\u9898\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"WIFi \u9650\u901f\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1fzfhj0hu1jj20ce07ydii.jpg\" style=\"width: 446px;height: 286px\" \/>\n<\/p>\n<p>\n\t\u4e8b\u60c5\u7ecf\u8fc7\u662f\u8fd9\u6837\u7684\uff0c\u4e00\u6b21\uff0c\u6211\u4eec\u751f\u4ea7\u4e0a\u670d\u52a1\u5668\u5927\u534a\u591c\u7684\u53d1\u51fa\u4e86\u62a5\u8b66\u4fe1\u606f\u3002CPU\u3001\u78c1\u76d8\u3001\u5e26\u5bbd\u90fd\u62a5\u8b66\uff0c\u5947\u4e86\u602a\u4e86\uff0c\u6700\u8fd1\u6ca1\u6709\u6d3b\u52a8\u554a\uff0c\u4e3a\u4ec0\u4e48\u5927\u665a\u4e0a\u7684\uff0c\u670d\u52a1\u5668\u5f02\u5e38\u5462\uff1f\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\u670d\u52a1\u5668\u5e26\u5bbd\u7206\u4e86\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1fzfhd52tixj21gc09swgu.jpg\" style=\"width: 1884px;height: 352px\" \/>\n<\/p>\n<p>\n\t\u4e8e\u662f\uff0c\u8d76\u7d27\u722c\u8d77\u6765\uff0c\u5206\u6790 Nginx \u7684\u65e5\u5fd7\u4fe1\u606f\uff0c\u53d1\u73b0\u6709\u4eba\u5728\u8fdb\u884c\u591a\u7ebf\u7a0b\u9ad8\u5e76\u53d1\u7684\u4e0b\u8f7d\u3002\u8fd9\u662f\u9ed1\u5ba2\u627e\u5230\u4e86\u6211\u4eec\u7684\u4e00\u4e2a\u7f3a\u70b9\uff0c\u7528\u591a\u7ebf\u7a0b\u4e0b\u8f7d\u7684\u65b9\u5f0f\u628a\u6211\u4eec\u670d\u52a1\u5668\u641e\u57ae\u4e86\u3002\u8fd9\u5f97\u8d76\u7d27\u89e3\u51b3\uff0c\u8981\u4e0d\u7136\u660e\u5929\u53c8\u8981\u559d\u8336\u3002\n<\/p>\n<pre class=\"brush:java;\">\r\n- [31\/May\/2018:00:01:03 -0700]  - xxx.ip.addr.xxx  GET \/download\/xttblog.zip HTTP\/1.1 - 192.168.100.15:8188 ups_resp_time: 0.010 request_time: 0.011\r\n- [31\/May\/2018:00:01:03 -0700]  - xxx.ip.addr.xxx  GET \/download\/xttblog.zip HTTP\/1.1 - 192.168.100.16:8188 ups_resp_time: 0.006 request_time: 0.006\r\n- [31\/May\/2018:00:01:03 -0700]  - xxx.ip.addr.xxx  GET \/download\/xttblog.zip HTTP\/1.1 - 192.168.100.15:8188 ups_resp_time: 0.013 request_time: 0.013\r\n- [31\/May\/2018:00:01:03 -0700]  - xxx.ip.addr.xxx  GET \/download\/xttblog.zip HTTP\/1.1 - 192.168.100.17:8188 ups_resp_time: 0.003 request_time: 0.003\r\n- [31\/May\/2018:00:01:03 -0700]  - xxx.ip.addr.xxx  GET \/download\/xttblog.zip HTTP\/1.1 - 192.168.100.18:8188 ups_resp_time: 0.004 request_time: 0.004\r\n- [31\/May\/2018:00:01:03 -0700]  - xxx.ip.addr.xxx  GET \/download\/xttblog.zip HTTP\/1.1 - 192.168.100.15:8188 ups_resp_time: 0.012 request_time: 0.013\r\n- [31\/May\/2018:00:01:03 -0700]  - xxx.ip.addr.xxx  GET \/download\/xttblog.zip HTTP\/1.1 - 192.168.100.18:8188 ups_resp_time: 0.005 request_time: 0.005\r\n- [31\/May\/2018:00:01:03 -0700]  - xxx.ip.addr.xxx  GET \/download\/xttblog.zip HTTP\/1.1 - 192.168.100.16:8188 ups_resp_time: 0.011 request_time: 0.011\r\n- [31\/May\/2018:00:01:03 -0700]  - xxx.ip.addr.xxx  GET \/download\/xttblog.zip HTTP\/1.1 - 192.168.100.15:8188 ups_resp_time: 0.447 request_time: 0.759<\/pre>\n<p>\n\t\u5f3a\u5927\u5982 CSDN \u90fd\u5728\u4e0b\u8f7d\u65f6\u63d0\u793a\u7981\u6b62\u4f7f\u7528\u8fc5\u96f7\u8fdb\u884c\u4e0b\u8f7d\u3002\u8fd8\u6709\u7fa4\u91cc\u4e00\u4e2a\u7f51\u53cb\u5206\u4eab\u7684 dl.xabc.io \u7f51\u7ad9\uff0c\u5728\u5e76\u53d1\u4e0b\u8f7d\u65f6\u90fd\u4f1a\u51fa\u73b0\u6545\u969c\u5b95\u673a\u3002\n<\/p>\n<p>\n\t\u540e\u6765\u6211\u60f3\u8d77\u6765\u4e86\uff0c\u5fc5\u987b\u5bf9\u4e0b\u8f7d\u9650\u901f\uff0c\u5e76\u4e14\u9650\u5236\u591a\u7ebf\u7a0b\u4e0b\u8f7d\u3002\u6709\u4e9b\u516c\u53f8\u9762\u8bd5\u4e2d\uff0c\u53ef\u80fd\u5c31\u4f1a\u95ee\u5230\uff0c\u5982\u4f55\u9650\u5236\u591a\u7ebf\u7a0b\u4e0b\u8f7d\uff1f\n<\/p>\n<p>\n\t\u5176\u5b9e\u5c31\u662f\u670d\u52a1\u7aef\u6839\u672c\u5c31\u4e0d\u8981\u63d0\u4f9b Content-Length \u503c\u3002\u8bd5\u60f3\u4e00\u4e0b\uff0c\u5982\u679c\u591a\u7ebf\u7a0b\u4e0b\u8f7d\u5de5\u5177\u5f97\u4e0d\u5230\u6587\u4ef6\u603b\u5927\u5c0f\u503c\uff0c\u5982\u4f55\u5206\u914d\u53bb\u5206\u914d\u6bcf\u4e2a\u7ebf\u7a0b\u9700\u8981\u4e0b\u8f7d\u7684\u91cf\u5462\uff1f\u4e0d\u5f97\u5df2\uff0c\u53ea\u80fd\u901a\u8fc7\u5355\u7ebf\u7a0b\u4e0b\u8f7d\u4e86\u3002\n<\/p>\n<p>\n\tNginx \u4e2d\u6709\u4e00\u4e2a ngx_http_core_module \u6a21\u5757\uff0c\u8be5\u6a21\u5757\u4e2d\u6709\u4e00\u4e2a limit_rate \u6307\u4ee4\u3002\u6211\u4eec\u6839\u636e\u5b83\u5c31\u53ef\u4ee5\u9650\u901f\uff0c\u5e76\u4e14\u914d\u5408 ngx_http_limit_conn_module \u6a21\u5757\u4e2d\u7684 limit_conn \u6307\u4ee4\u53ef\u4ee5\u9650\u5236\u7ebf\u7a0b\u6570\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\nhttp {\r\n    limit_zone xttblog $binary_remote_addr 10m;\r\n    ...\r\n    server {\r\n        ...\r\n        location \/download\/ {\r\n            ...\r\n            limit_rate 100k; #\u9650\u5236\u901f\u5ea6 \r\n            limit_rate_after 1m;\r\n            limit_conn xttblog 2; #\u9650\u5236\u7ebf\u7a0b\r\n            ...\r\n        }\r\n    }\r\n}<\/pre>\n<p>\n\t\u6307\u4ee4 limit_rate \u8868\u793a\u8bbe\u7f6e\u6700\u9ad8\u4e0b\u8f7d\u901f\u5ea6\uff1b\u6307\u4ee4 limit_rate_after \u4ece\u4e0b\u8f7d\u5230\u4f60\u6307\u5b9a\u7684\u6587\u4ef6\u5927\u5c0f\u4e4b\u540e\u5f00\u59cb\u9650\u901f\u3002\u4f46\u662f\u8fd9\u4e2a\u8bbe\u7f6e\u662f\u9650\u5236\u7684\u662f\u6bcf\u4e00\u4e2a\u8fde\u63a5\u7684\u4e0b\u8f7d\u901f\u5ea6\uff0c\u6240\u4ee5\u5982\u679c\u4e00\u4e2a\u7528\u6237\u6253\u5f00\u4e86\u591a\u4e2a\u8fde\u63a5\u4e0b\u8f7d\uff0c\u90a3\u4e48\u5b83\u7684\u4e0b\u8f7d\u901f\u5ea6\u5c31\u80fd\u8fbe\u5230\u5355\u4e2a\u8fde\u63a5\u7684\u9650\u901f\u4e58\u4ee5\u8fde\u63a5\u6570\u3002\n<\/p>\n<p>\n\t\u6240\u4ee5\uff0climit_zone \u6307\u4ee4\u5b9a\u4e49\u4e00\u4e2a\u53eb&ldquo;xttblog&rdquo;\u7684\u8bb0\u5f55\u533a\uff0c\u603b\u5bb9\u91cf\u4e3a 10M\uff0c\u4ee5\u53d8\u91cf $binary_remote_addr \u4f5c\u4e3a\u4f1a\u8bdd\u7684\u5224\u65ad\u57fa\u51c6\uff08\u5373\u4e00\u4e2a\u5730\u5740\u4e00\u4e2a\u4f1a\u8bdd\uff09\u3002\u9650\u5236 \/download\/ \u76ee\u5f55\u4e0b\uff0c\u4e00\u4e2a\u4f1a\u8bdd\u53ea\u80fd\u8fdb\u884c\u4e00\u4e2a\u8fde\u63a5\u3002\u7b80\u5355\u70b9\uff0c\u5c31\u662f\u9650\u5236 \/download\/ \u76ee\u5f55\u4e0b\uff0c\u4e00\u4e2a IP \u53ea\u80fd\u53d1\u8d77 2 \u4e2a\u8fde\u63a5\uff0c\u591a\u8fc7 2 \u4e2a\uff0c\u4e00\u5f8b 503\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\u8fc5\u96f7\u4e0b\u8f7d\u88ab\u9650\u5236\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1fzfhac6t97j20lu02yaae.jpg\" style=\"width: 786px;height: 106px\" \/>\n<\/p>\n<p>\n\t\u914d\u7f6e\u5b8c\u540e\uff0c\u91cd\u542f Nginx\uff0c\u8fc5\u96f7\u4e0b\u8f7d\u4e0d\u8d85\u8fc7 1M\uff0c\u88ab\u9650\u5236\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"360 \u6d4f\u89c8\u5668\u4e0b\u8f7d\u88ab\u9650\u5236\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1fzfhbwe3z5j20i20br74q.jpg\" style=\"width: 650px;height: 423px\" \/>\n<\/p>\n<p>\n\t360 \u6d4f\u89c8\u5668\u4e0b\u8f7d\u4e0d\u8d85\u8fc7 1M\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\u8c37\u6b4c\u6d4f\u89c8\u5668\u4e0b\u8f7d\u88ab\u9650\u5236\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1fzfhckftizj20j206ewep.jpg\" style=\"width: 686px;height: 230px\" \/>\n<\/p>\n<p>\n\t\u8c37\u6b4c\u6d4f\u89c8\u5668\u4e0b\u8f7d\u4e5f\u4e0d\u8d85\u8fc7 1M\u3002\u5176\u4ed6\u7684\u6211\u5c31\u4e0d\u5728\u622a\u56fe\u4e86\uff0c\u90fd\u88ab\u9650\u5236\u4e86\u3002\u7136\u540e\uff0c\u7ed3\u679c\u4f60\u4eec\u90fd\u77e5\u9053\u4e86\uff0c\u670d\u52a1\u5668\u5e26\u5bbd\u7b49\u90fd\u6062\u590d\u6b63\u5e38\u3002\n<\/p>\n<p>\n\t\u53ea\u6709\u4f60\u53c8\u5f53\u7239\u53c8\u5f53\u5988\u7684\u65f6\u5019\uff0c\u4f60\u624d\u77e5\u9053\u8fd9\u4e9b\u77e5\u8bc6\u7684\u91cd\u8981\u6027\uff01<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=3771\">\u4e00\u6b21\u751f\u4ea7\u4e8b\u6545\u8ba9\u6211\u5b66\u4f1a\u4e86 Nginx \u9650\u901f<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u524d\u65b9\u7684\u8def\u90fd\u662f\u5751\uff0c\u53ea\u6709\u4f60\u8e29\u8fc7\uff0c\u4f60\u624d\u77e5\u9053\uff0c\u7ecf\u9a8c\u5c31\u662f\u94b1\u3002\u522b\u95ee\u516c\u53f8\u91cc\uff0c\u540c\u6837\u6572\u7684\u4ee3\u7801\uff0c\u4e3a\u5565\u522b\u4eba\u6bd4\u4f60\u5de5\u8d44\u9ad8\uff0c\u56e0\u4e3a\u522b\u4eba\u8e29\u7684\u5751 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[565,1152,313,1154,733],"class_list":["post-3771","post","type-post","status-publish","format-standard","hentry","category-yyzt","tag-java-","tag-nginx","tag-nginx-tfs","tag-733"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3771","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3771"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3771\/revisions"}],"predecessor-version":[{"id":3772,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3771\/revisions\/3772"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}