{"id":63589,"date":"2025-04-29T13:58:23","date_gmt":"2025-04-29T05:58:23","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63589\/"},"modified":"2025-04-29T13:58:23","modified_gmt":"2025-04-29T05:58:23","slug":"nginx%e9%98%b2%e7%81%ab%e5%a2%99%e6%80%8e%e4%b9%88%e5%85%b3%e9%97%ad-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63589\/","title":{"rendered":"nginx\u9632\u706b\u5899\u600e\u4e48\u5173\u95ed"},"content":{"rendered":"<blockquote><p>\n  \u5173\u95ed nginx \u9632\u706b\u5899\uff1a\u6253\u5f00 nginx \u4e3b\u914d\u7f6e\u6587\u4ef6 \/etc\/nginx\/nginx.conf\u3002\u5728 http \u5757\u4e2d\u5220\u9664\u9632\u706b\u5899\u914d\u7f6e\u6307\u4ee4\u3002\u4fdd\u5b58\u914d\u7f6e\u6587\u4ef6\u5e76\u91cd\u542f nginx\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/29\/2024052911361741341.jpg\" class=\"aligncenter\" title=\"nginx\u9632\u706b\u5899\u600e\u4e48\u5173\u95ed\u63d2\u56fe\" alt=\"nginx\u9632\u706b\u5899\u600e\u4e48\u5173\u95ed\u63d2\u56fe\" \/><\/p>\n<p><strong> \u9632\u706b\u5899\u5173\u95ed\u6b65\u9aa4<\/strong><\/p>\n<p>\u8981\u5173\u95ed nginx \u9632\u706b\u5899\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<p><strong>1. \u6253\u5f00\u914d\u7f6e\u6587\u4ef6<\/strong><\/p>\n<p>\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00 nginx \u4e3b\u914d\u7f6e\u6587\u4ef6\uff0c\u901a\u5e38\u4f4d\u4e8e \/etc\/nginx\/nginx.conf\u3002<\/p>\n<p><strong>2. \u67e5\u627e HTTP \u5757<\/strong><\/p>\n<p>\u627e\u5230\u4ee5\u4e0b\u90e8\u5206\uff1a<\/p>\n<pre>http {\n  # ...\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u53bb\u9664<\/strong><\/p>\n<p>\u4ece\u8be5\u5757\u4e2d\u5220\u9664\u4ee5\u4e0b\u6307\u4ee4\uff1a<\/p>\n<pre># ...\n  limit_req_zone $binary_remote_addr zone=one:10m rate=5r\/s;\n  limit_req_status 403;\n# ...<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u4fdd\u5b58\u66f4\u6539<\/strong><\/p>\n<p>\u4fdd\u5b58\u5e76\u5173\u95ed\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<p><strong>5. \u91cd\u542f nginx<\/strong><\/p>\n<p>\u91cd\u542f nginx \u4ee5\u5e94\u7528\u66f4\u6539\uff1a<\/p>\n<pre>sudo systemctl restart nginx<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5373\u53ef\u751f\u6548<\/strong><\/p>\n<p>\u5b8c\u6210\u4e0a\u8ff0\u6b65\u9aa4\u540e\uff0cnginx \u9632\u706b\u5899\u5c06\u88ab\u5173\u95ed\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u9632\u706b\u5899\u600e\u4e48\u5173\u95ed\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5173\u95ed nginx \u9632\u706b\u5899\uff1a\u6253\u5f00 nginx \u4e3b\u914d\u7f6e\u6587\u4ef6 \/etc\/nginx\/nginx.conf\u3002\u5728 http \u5757\u4e2d\u5220\u9664\u9632\u706b\u5899\u914d\u7f6e\u6307\u4ee4\u3002\u4fdd\u5b58\u914d\u7f6e\u6587\u4ef6\u5e76\u91cd\u542f nginx\u3002 \u9632\u706b\u5899\u5173\u95ed\u6b65\u9aa4 \u8981\u5173\u95ed nginx \u9632\u706b\u5899\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a 1. \u6253\u5f00\u914d\u7f6e\u6587\u4ef6 \u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00 nginx \u4e3b\u914d\u7f6e\u6587\u4ef6\uff0c\u901a\u5e38\u4f4d\u4e8e \/etc\/nginx\/nginx.conf\u3002 2. \u67e5\u627e HTTP \u5757 \u627e\u5230\u4ee5\u4e0b\u90e8\u5206\uff1a http { # &#8230; } \u767b\u5f55\u540e\u590d\u5236 3. \u53bb\u9664 \u4ece\u8be5\u5757\u4e2d\u5220\u9664\u4ee5\u4e0b\u6307\u4ee4\uff1a # &#8230; limit_req_zone $binary_remote_addr zone=one:10m rate=5r\/s; limit_req_status 403; # &#8230; \u767b\u5f55\u540e\u590d\u5236 4. \u4fdd\u5b58\u66f4\u6539 \u4fdd\u5b58\u5e76\u5173\u95ed\u914d\u7f6e\u6587\u4ef6\u3002 5. \u91cd\u542f nginx \u91cd\u542f nginx \u4ee5\u5e94\u7528\u66f4\u6539\uff1a sudo systemctl [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-63589","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63589","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=63589"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63589\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63589"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63589"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}