{"id":12715,"date":"2025-04-18T19:47:47","date_gmt":"2025-04-18T11:47:47","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/12715.html"},"modified":"2025-04-18T19:47:47","modified_gmt":"2025-04-18T11:47:47","slug":"%e5%88%a9%e7%94%a8nginx%e5%9c%a8%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%e9%83%a8%e7%bd%b2%e4%bd%a0%e7%9a%84%e7%ac%ac%e4%b8%80%e4%b8%aa%e9%9d%99%e6%80%81%e9%a1%b5%e9%9d%a2","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/12715.html","title":{"rendered":"\u5229\u7528Nginx\u5728\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u4f60\u7684\u7b2c\u4e00\u4e2a\u9759\u6001\u9875\u9762"},"content":{"rendered":"<\/p>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>\u5e8f\u8a00<\/li>\n<li>Nginx\u5e38\u7528\u529f\u80fd<\/li>\n<li>\n<ul>\n<li>1. \u53cd\u5411\u4ee3\u7406<\/li>\n<li>2.\u8d1f\u8f7d\u5747\u8861<\/li>\n<li>\n<ul>\n<li>\u8f6e\u8be2<\/li>\n<li>\u52a0\u6743\u8f6e\u8be2<\/li>\n<li>IP_Hash<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Nginx\u914d\u7f6e\u6587\u4ef6\u7ed3\u6784<\/li>\n<li>\u5b89\u88c5\u5e76\u90e8\u7f72\u4f60\u7684\u9759\u6001\u7f51\u9875<\/li>\n<li>\n<ul>\n<li>1. \u5b89\u88c5(\u61d2\u4eba\u76f4\u63a5\u770b3)<\/li>\n<li>2.\u67e5\u770b\u914d\u7f6e\u6587\u4ef6<\/li>\n<li>3.\u7f16\u5199\u6216\u653e\u5165\u81ea\u5df1\u7684\u9759\u6001\u9875\u9762\u6587\u4ef6<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>\u5e8f\u8a00<\/h2>\n<p>\u9996\u5148\u6211\u4eec\u5148\u6765\u8ba4\u8bc6\u4e00\u4e0b\u4ec0\u4e48\u662fNginx\u6e90\u7801 \u5b98\u7f51<\/p>\n<p>Nginx (engine x) \u662f\u4e00\u4e2a\u9ad8\u6027\u80fd\u7684HTTP\u548c\u53cd\u5411\u4ee3\u7406web\u670d\u52a1\u5668&#xff0c;\u662f\u7531\u4f0a\u6208\u5c14\u00b7\u8d5b\u7d22\u8036\u592b\u4e3a\u4fc4\u7f57\u65af\u8bbf\u95ee\u91cf\u7b2c\u4e8c\u7684Rambler.ru\u7ad9\u70b9&#xff08;\u4fc4\u6587&#xff1a;\u0420\u0430\u043c\u0431\u043b\u0435\u0440&#xff09;\u5f00\u53d1\u7684&#xff0c;\u7b2c\u4e00\u4e2a\u516c\u5f00\u7248\u672c0.1.0\u53d1\u5e03\u4e8e2004\u5e7410\u67084\u65e5\u3002\u5176\u5c06\u6e90\u4ee3\u7801\u4ee5\u7c7bBSD\u8bb8\u53ef\u8bc1\u7684\u5f62\u5f0f\u53d1\u5e03&#xff0c;\u56e0\u5b83\u7684\u7a33\u5b9a\u6027\u3001\u4e30\u5bcc\u7684\u529f\u80fd\u96c6\u3001\u7b80\u5355\u7684\u914d\u7f6e\u6587\u4ef6\u548c\u4f4e\u7cfb\u7edf\u8d44\u6e90\u7684\u6d88\u8017\u800c\u95fb\u540d\u30022011\u5e746\u67081\u65e5&#xff0c;nginx 1.0.4\u53d1\u5e03\u3002<\/p>\n<ul>\n<li>Nginx\u662f\u4e00\u6b3e\u8f7b\u91cf\u7ea7\u7684Web \u670d\u52a1\u5668\/\u53cd\u5411\u4ee3\u7406\u670d\u52a1\u5668\u53ca\u7535\u5b50\u90ae\u4ef6&#xff08;IMAP\/POP3&#xff09;\u4ee3\u7406\u670d\u52a1\u5668&#xff0c;\u5728BSD-like \u534f\u8bae\u4e0b\u53d1\u884c\u3002\u652f\u6301FastCGI\u3001SSL\u3001Virtual Host\u3001URL Rewrite\u3001Gzip\u7b49\u529f\u80fd\u3002\u5e76\u4e14\u652f\u6301\u5f88\u591a\u7b2c\u4e09\u65b9\u7684\u6a21\u5757\u6269\u5c55\u3002<\/li>\n<li>\u5176\u7279\u70b9\u662f\u5360\u6709\u5185\u5b58\u5c11&#xff0c;\u5e76\u53d1\u80fd\u529b\u5f3a&#xff0c;\u4e8b\u5b9e\u4e0anginx\u7684\u5e76\u53d1\u80fd\u529b\u5728\u540c\u7c7b\u578b\u7684\u7f51\u9875\u670d\u52a1\u5668\u4e2d\u8868\u73b0\u8f83\u597d&#xff0c;\u4e2d\u56fd\u5927\u9646\u4f7f\u7528nginx\u7f51\u7ad9\u7528\u6237\u6709&#xff1a;\u767e\u5ea6\u3001\u4eac\u4e1c\u3001\u65b0\u6d6a\u3001\u7f51\u6613\u3001\u817e\u8baf\u3001\u6dd8\u5b9d\u7b49\u3002\u5176\u7a33\u5b9a\u6027\u3001\u529f\u80fd\u96c6\u3001\u793a\u4f8b\u914d\u7f6e\u6587\u4ef6\u548c\u4f4e\u7cfb\u7edf\u8d44\u6e90\u7684\u6d88\u8017\u8ba9\u4ed6\u540e\u6765\u5c45\u4e0a&#xff0c;\u5728\u5168\u7403\u6d3b\u8dc3\u7684\u7f51\u7ad9\u4e2d\u670912.18%\u7684\u4f7f\u7528\u6bd4\u7387&#xff0c;\u5927\u7ea6\u4e3a2220\u4e07\u4e2a\u7f51\u7ad9\u3002<\/li>\n<li>Nginx \u662f\u9ad8\u6027\u80fd\u7684 HTTP \u548c\u53cd\u5411\u4ee3\u7406\u7684web\u670d\u52a1\u5668&#xff0c;\u5904\u7406\u9ad8\u5e76\u53d1\u80fd\u529b\u662f\u5341\u5206\u5f3a\u5927\u7684&#xff0c;\u80fd\u7ecf\u53d7\u9ad8\u8d1f \u8f7d\u7684\u8003\u9a8c,\u6709\u62a5\u544a\u8868\u660e\u80fd\u652f\u6301\u9ad8\u8fbe 50,000 \u4e2a\u5e76\u53d1\u8fde\u63a5\u6570\u3002<\/li>\n<li>Nginx\u652f\u6301\u70ed\u90e8\u7f72&#xff0c;\u542f\u52a8\u7b80\u5355&#xff0c;\u53ef\u4ee5\u505a\u52307*24\u4e0d\u95f4\u65ad\u8fd0\u884c\u3002\u51e0\u4e2a\u6708\u90fd\u4e0d\u9700\u8981\u91cd\u65b0\u542f\u52a8\u3002<\/li>\n<\/ul>\n<hr \/>\n<h2>Nginx\u5e38\u7528\u529f\u80fd<\/h2>\n<h3>1. \u53cd\u5411\u4ee3\u7406<\/h3>\n<p>\u4f5c\u4e3a\u5f00\u53d1\u8005,\u5927\u5bb6\u53ef\u80fd\u5df2\u7ecf\u6216\u591a\u6216\u5c11\u90fd\u63a5\u89e6\u8fc7Nginx\u6216\u8005\u4ee3\u7406,\u53cd\u5411\u4ee3\u7406\u8fd9\u4e9b\u540d\u8bcd,\u800c\u53cd\u5411\u4ee3\u7406\u6b63\u662fNginx\u7684\u4e00\u4e2a\u4e3b\u8981\u529f\u80fd,\u5148\u6765\u4e24\u5f20\u56fe\u89c2\u5bdf\u4e00\u4e9b\u4ee3\u7406\u5728\u7f51\u7edc\u4e2d\u7684\u4f4d\u7f6e.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418114737-68023bd9e400c.png\" alt=\"img\" \/><\/p>\n<p>\u7b80\u6d01\u7684\u8bf4&#xff1a;\u6b63\u5411\u4ee3\u7406\u5c31\u662f\u9690\u85cf\u5ba2\u6237\u7aef&#xff0c;\u800c\u53cd\u5411\u4ee3\u7406\u662f\u9690\u85cf\u670d\u52a1\u5668<\/p>\n<li>\u6b63\u5411\u4ee3\u7406\u662f\u5ba2\u6237\u7aef\u53d1\u9001\u8bf7\u6c42\u540e\u901a\u8fc7\u4ee3\u7406\u670d\u52a1\u5668\u8bbf\u95ee\u76ee\u6807\u670d\u52a1\u5668&#xff0c;\u4ee3\u7406\u670d\u52a1\u5668\u4ee3\u8868\u5ba2\u6237\u7aef\u53d1\u9001\u8bf7\u6c42\u5e76\u5c06\u54cd\u5e94\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u3002\u6b63\u5411\u4ee3\u7406\u9690\u85cf\u4e86\u5ba2\u6237\u7aef\u7684\u771f\u5b9e\u8eab\u4efd\u548c\u4f4d\u7f6e\u4fe1\u606f&#xff0c;\u4e3a\u5ba2\u6237\u7aef\u63d0\u4f9b\u4ee3\u7406\u8bbf\u95ee\u4e92\u8054\u7f51\u7684\u529f\u80fd\u3002\u5e73\u65f6\u6211\u4eec\u4f1a\u6709\u8bbf\u95eeGitHub\u7b49\u7f51\u7ad9\u7684\u529f\u80fd,\u4f46\u662f\u76f4\u63a5\u4f7f\u7528\u56fd\u5185\u7684\u670d\u52a1\u5668\u65e0\u6cd5\u8bbf\u95ee,\u6216\u8bbf\u95ee\u901f\u5ea6\u6162,\u6b64\u65f6\u5c31\u53ef\u4ee5\u901a\u8fc7\u4e00\u4e2a\u4ee3\u7406\u670d\u52a1\u5668\u5e2e\u52a9\u6211\u4eec\u8bbf\u95ee,\u5bf9\u4e8e\u76ee\u6807\u670d\u52a1\u5668\u6765\u8bf4,\u6536\u5230\u4e86\u4ee3\u7406\u670d\u52a1\u5668\u7684\u8bf7\u6c42\u800c\u9690\u85cf\u4e86\u771f\u5b9e\u5ba2\u6237\u7aef<\/li>\n<li>\u53cd\u5411\u4ee3\u7406\u662f\u4f4d\u4e8e\u76ee\u6807\u670d\u52a1\u5668\u548c\u5ba2\u6237\u7aef\u4e4b\u95f4\u7684\u4ee3\u7406\u670d\u52a1\u5668&#xff0c;\u5b83\u4ee3\u8868\u670d\u52a1\u5668\u63a5\u6536\u5ba2\u6237\u7aef\u7684\u8bf7\u6c42\u5e76\u5c06\u8bf7\u6c42\u8f6c\u53d1\u5230\u771f\u6b63\u7684\u76ee\u6807\u670d\u52a1\u5668\u4e0a&#xff0c;\u5e76\u5c06\u5f97\u5230\u7684\u54cd\u5e94\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u3002\u53cd\u5411\u4ee3\u7406\u9690\u85cf\u4e86\u670d\u52a1\u5668\u7684\u771f\u5b9e\u8eab\u4efd\u548c\u4f4d\u7f6e\u4fe1\u606f&#xff0c;\u5ba2\u6237\u7aef\u53ea\u77e5\u9053\u4e0e\u53cd\u5411\u4ee3\u7406\u8fdb\u884c\u901a\u4fe1&#xff0c;\u800c\u4e0d\u77e5\u9053\u771f\u6b63\u7684\u670d\u52a1\u5668\u3002 \u6bd4\u5982&#xff1a;\u6211\u4eec\u8bbf\u95ee\u6dd8\u5b9d\u7684\u65f6\u5019&#xff0c;\u6dd8\u5b9d\u5185\u90e8\u80af\u5b9a\u4e0d\u662f\u53ea\u6709\u4e00\u53f0\u670d\u52a1\u5668&#xff0c;\u5b83\u7684\u5185\u90e8\u6709\u5f88\u591a\u53f0\u670d\u52a1\u5668&#xff0c;\u90a3\u6211\u4eec\u8fdb\u884c\u8bbf\u95ee\u7684\u65f6\u5019&#xff0c;\u56e0\u4e3a\u670d\u52a1\u5668\u4e2d\u95f4session\u4e0d\u5171\u4eab&#xff0c;\u90a3\u6211\u4eec\u662f\u4e0d\u662f\u5728\u670d\u52a1\u5668\u4e4b\u95f4\u8bbf\u95ee\u9700\u8981\u9891\u7e41\u767b\u5f55&#xff0c;\u90a3\u8fd9\u4e2a\u65f6\u5019\u6dd8\u5b9d\u642d\u5efa\u4e00\u4e2a\u8fc7\u6e21\u670d\u52a1\u5668&#xff0c;\u5bf9\u6211\u4eec\u662f\u6ca1\u6709\u4efb\u4f55\u5f71\u54cd\u7684&#xff0c;\u6211\u4eec\u662f\u767b\u5f55\u4e00\u6b21&#xff0c;\u4f46\u662f\u8bbf\u95ee\u6240\u6709,\u5bf9\u6211\u4eec\u6765\u8bf4&#xff0c;\u5ba2\u6237\u7aef\u5bf9\u4ee3\u7406\u662f\u65e0\u611f\u77e5\u7684&#xff0c;\u5ba2\u6237\u7aef\u4e0d\u9700\u8981\u4efb\u4f55\u914d\u7f6e\u5c31\u53ef\u4ee5\u8bbf\u95ee&#xff0c;\u6211\u4eec\u53ea\u9700\u8981\u628a\u8bf7\u6c42\u53d1\u9001\u7ed9\u53cd\u5411\u4ee3\u7406\u670d\u52a1\u5668&#xff0c;\u7531\u53cd\u5411\u4ee3\u7406\u670d\u52a1\u5668\u53bb\u9009\u62e9\u76ee\u6807\u670d\u52a1\u5668\u83b7\u53d6\u6570\u636e\u540e&#xff0c;\u518d\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef&#xff0c;\u6b64\u65f6\u53cd\u5411\u4ee3\u7406\u670d\u52a1\u5668\u548c\u76ee\u6807\u670d\u52a1\u5668\u5bf9\u5916\u5c31\u662f\u4e00\u4e2a\u670d\u52a1\u5668&#xff0c;\u66b4\u9732\u7684\u662f\u4ee3\u7406\u670d\u52a1\u5668\u5730\u5740&#xff0c;\u9690\u85cf\u4e86\u771f\u5b9e\u670d\u52a1\u5668\u7684\u5730\u5740\u3002<\/li>\n<p>        # \u53cd\u5411\u4ee3\u7406,\u5904\u7406\u7ba1\u7406\u7aef\u53d1\u9001\u7684\u8bf7\u6c42<br \/>\n        location \/api\/ {<br \/>\n            proxy_pass   http:\/\/localhost:8080\/admin\/;<br \/>\n            #proxy_pass   http:\/\/webservers\/admin\/;<br \/>\n        }<\/p>\n<p>        # \u53cd\u5411\u4ee3\u7406,\u5904\u7406\u7528\u6237\u7aef\u53d1\u9001\u7684\u8bf7\u6c42<br \/>\n        location \/user\/ {<br \/>\n            proxy_pass   http:\/\/webservers\/user\/;<br \/>\n        }<\/p>\n<p>        # WebSocket<br \/>\n        location \/ws\/ {<br \/>\n            proxy_pass   http:\/\/webservers\/ws\/;<br \/>\n            proxy_http_version 1.1;<br \/>\n            proxy_read_timeout 3600s;<br \/>\n            proxy_set_header Upgrade $http_upgrade;<br \/>\n            proxy_set_header Connection &#034;$connection_upgrade&#034;;<br \/>\n        }<\/p>\n<h3>2.\u8d1f\u8f7d\u5747\u8861<\/h3>\n<p>\u8d1f\u8f7d\u5747\u8861\u662fNginx\u7684\u53c8\u4e00\u5927\u7279\u70b9,\u8d1f\u8f7d\u5747\u8861&#xff08;Load Balancing&#xff09;\u662f\u4e00\u79cd\u5206\u914d\u5de5\u4f5c\u8d1f\u8f7d&#xff08;\u5373\u8bf7\u6c42\u6216\u6570\u636e&#xff09;\u5230\u591a\u4e2a\u8ba1\u7b97\u8d44\u6e90\u7684\u6280\u672f&#xff0c;\u76ee\u7684\u662f\u5728\u4e0d\u8fc7\u8f7d\u4efb\u4f55\u5355\u4e2a\u8d44\u6e90\u7684\u60c5\u51b5\u4e0b\u63d0\u9ad8\u6574\u4f53\u7cfb\u7edf\u6027\u80fd,\u589e\u5f3a\u53ef\u9760\u6027\u548c\u53ef\u6269\u5c55\u6027\u3002\u5176\u5b9e\u5c31\u662f\u591a\u4e2a\u670d\u52a1\u5668\u8f6e\u8f6c\u63a5\u6536\u5ba2\u6237\u7aef\u8bf7\u6c42&#xff0c;\u51cf\u8f7b\u5355\u53f0\u670d\u52a1\u5668\u538b\u529b\u3002<\/p>\n<h4>\u8f6e\u8be2<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418114738-68023bda13091.png\" alt=\"img\" \/> \u6bcf\u4e2a\u8bf7\u6c42\u6309\u65f6\u95f4\u987a\u5e8f\u9010\u4e00\u5206\u914d\u5230\u4e0d\u540c\u7684\u540e\u7aef\u670d\u52a1\u5668&#xff0c;\u5982\u679c\u540e\u7aef\u670d\u52a1\u5668down\u6389&#xff0c;\u80fd\u81ea\u52a8\u5254\u9664\u3002 \u9002\u5408\u670d\u52a1\u5668\u914d\u7f6e\u76f8\u5f53&#xff0c;\u65e0\u72b6\u6001\u4e14\u77ed\u5e73\u5feb\u7684\u670d\u52a1\u4f7f\u7528\u3002\u4e5f\u9002\u7528\u4e8e\u56fe\u7247\u670d\u52a1\u5668\u96c6\u7fa4\u548c\u7eaf\u9759\u6001\u9875\u9762\u670d\u52a1\u5668\u96c6\u7fa4\u3002<\/p>\n<h4>\u52a0\u6743\u8f6e\u8be2<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418114738-68023bdaaeaed.png\" alt=\"img\" \/> \u6307\u5b9a\u8f6e\u8be2\u51e0\u7387&#xff0c;weight\u548c\u8bbf\u95ee\u6bd4\u7387\u6210\u6b63\u6bd4&#xff0c;\u7528\u4e8e\u540e\u7aef\u670d\u52a1\u5668\u6027\u80fd\u4e0d\u5747\u7684 \u60c5\u51b5\u3002\u8fd9\u79cd\u65b9\u5f0f\u6bd4\u8f83\u7075\u6d3b&#xff0c;\u5f53\u540e\u7aef\u670d\u52a1\u5668\u6027\u80fd\u5b58\u5728\u5dee\u5f02\u7684\u65f6\u5019&#xff0c;\u901a\u8fc7\u914d\u7f6e\u6743\u91cd&#xff0c;\u53ef\u4ee5\u8ba9\u670d\u52a1\u5668\u7684\u6027\u80fd\u5f97\u5230\u5145\u5206\u53d1\u6325&#xff0c;\u6709\u6548\u5229\u7528\u8d44\u6e90\u3002weight\u548c\u8bbf\u95ee\u6bd4\u7387\u6210\u6b63\u6bd4&#xff0c;\u7528\u4e8e\u540e\u7aef\u670d\u52a1\u5668\u6027\u80fd\u4e0d\u5747\u7684\u60c5\u51b5\u3002\u6743\u91cd\u8d8a\u9ad8&#xff0c;\u5728\u88ab\u8bbf\u95ee\u7684\u6982\u7387\u8d8a\u5927<\/p>\n<p>\u52a0\u6743\u8f6e\u8be2\u793a\u4f8b:<\/p>\n<p>    upstream webservers{<br \/>\n      server 127.0.0.1:8080 weight&#061;90 ;<br \/>\n      #server 127.0.0.1:8088 weight&#061;10 ;<br \/>\n    }<\/p>\n<h4>IP_Hash<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418114739-68023bdb57cfb.png\" alt=\"img\" \/><\/p>\n<p>\u4e0a\u8ff0\u65b9\u5f0f\u5b58\u5728\u4e00\u4e2a\u95ee\u9898:\u5728\u8d1f\u8f7d\u5747\u8861\u7cfb\u7edf\u4e2d&#xff0c;\u5047\u5982\u7528\u6237\u5728\u67d0\u53f0\u670d\u52a1\u5668\u4e0a\u767b\u5f55\u4e86&#xff0c;\u90a3\u4e48\u8be5\u7528\u6237\u7b2c\u4e8c\u6b21\u8bf7\u6c42\u7684\u65f6\u5019&#xff0c;\u56e0\u4e3a\u6211\u4eec\u662f\u8d1f\u8f7d\u5747\u8861\u7cfb\u7edf&#xff0c;\u6bcf\u6b21\u8bf7\u6c42\u90fd\u4f1a\u91cd\u65b0\u5b9a\u4f4d\u5230\u670d\u52a1\u5668\u96c6\u7fa4\u4e2d\u7684\u67d0\u4e00\u4e2a&#xff0c;\u90a3\u4e48\u5df2\u7ecf\u767b\u5f55\u67d0\u4e00\u4e2a\u670d\u52a1\u5668\u7684\u7528\u6237\u518d\u91cd\u65b0\u5b9a\u4f4d\u5230\u53e6\u4e00\u4e2a\u670d\u52a1\u5668&#xff0c;\u5176\u767b\u5f55\u4fe1\u606f\u5c06\u4f1a\u4e22\u5931&#xff0c;\u8fd9\u6837\u663e\u7136\u662f\u4e0d\u59a5\u7684\u3002 \u6211\u4eec\u53ef\u4ee5\u91c7\u7528ip_hash\u6307\u4ee4\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898&#xff0c;\u5982\u679c\u5ba2\u6237\u5df2\u7ecf\u8bbf\u95ee\u4e86\u67d0\u4e2a\u670d\u52a1\u5668&#xff0c;\u5f53\u7528\u6237\u518d\u6b21\u8bbf\u95ee\u65f6&#xff0c;\u4f1a\u5c06\u8be5\u8bf7\u6c42\u901a\u8fc7\u54c8\u5e0c\u7b97\u6cd5&#xff0c;\u81ea\u52a8\u5b9a\u4f4d\u5230\u8be5\u670d\u52a1\u5668\u3002\u6bcf\u4e2a\u8bf7\u6c42\u6309\u8bbf\u95eeip\u7684hash\u7ed3\u679c\u5206\u914d&#xff0c;\u8fd9\u6837\u6bcf\u4e2a\u8bbf\u5ba2\u56fa\u5b9a\u8bbf\u95ee\u4e00\u4e2a\u540e\u7aef\u670d\u52a1\u5668&#xff0c;\u53ef\u4ee5\u89e3\u51b3session\u7684\u95ee\u9898\u3002<\/p>\n<h2>Nginx\u914d\u7f6e\u6587\u4ef6\u7ed3\u6784<\/h2>\n<p>\u5728\u6b63\u5f0f\u5f00\u59cb\u4f7f\u7528Nginx\u4e4b\u524d\u7684\u6700\u540e\u4e00\u90e8,\u6211\u4eec\u5148\u4e86\u89e3\u4e00\u4e0bNginx\u7684\u914d\u7f6e\u6587\u4ef6,\u6240\u8c13\u78e8\u5200\u4e0d\u8bef\u780d\u67f4\u5de5~<\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u627e\u5230Nginx\/config\/nginx.config \u8fd9\u91cc\u5c31\u5b58\u653e\u4e86nginx\u7684\u6838\u5fc3<\/p>\n<p>\u4ee5\u4e0b\u4e3a\u6574\u4f53\u7ed3\u6784<\/p>\n<p>&#8230;              #\u5168\u5c40\u5757<\/p>\n<p>events {         #events\u5757<br \/>\n   &#8230;<br \/>\n}<\/p>\n<p>http      #http\u5757<br \/>\n{<br \/>\n    &#8230;   #http\u5168\u5c40\u5757<br \/>\n    server        #server\u5757<br \/>\n    {<br \/>\n        &#8230;       #server\u5168\u5c40\u5757<br \/>\n        location [PATTERN]   #location\u5757<br \/>\n        {<br \/>\n            &#8230;<br \/>\n        }<br \/>\n        location [PATTERN]<br \/>\n        {<br \/>\n            &#8230;<br \/>\n        }<br \/>\n    }<br \/>\n    server<br \/>\n    {<br \/>\n      &#8230;<br \/>\n    }<br \/>\n    &#8230;     #http\u5168\u5c40\u5757<br \/>\n}<\/p>\n<ul>\n<li>\u5168\u5c40\u5757&#xff1a;\u914d\u7f6e\u5f71\u54cdnginx\u5168\u5c40\u7684\u6307\u4ee4\u3002\u4e00\u822c\u6709\u8fd0\u884cnginx\u670d\u52a1\u5668\u7684\u7528\u6237\u7ec4&#xff0c;nginx\u8fdb\u7a0bpid\u5b58\u653e\u8def\u5f84&#xff0c;\u65e5\u5fd7\u5b58\u653e\u8def\u5f84&#xff0c;\u914d\u7f6e\u6587\u4ef6\u5f15\u5165&#xff0c;\u5141\u8bb8\u751f\u6210worker process\u6570\u7b49(\u8fd9\u4e2a\u914d\u7f6e\u6307\u5b9a\u4e86Nginx\u670d\u52a1\u5668\u7684\u5de5\u4f5c\u8fdb\u7a0b\u6570\u3002\u5de5\u4f5c\u8fdb\u7a0b\u662fNginx\u7528\u4e8e\u5904\u7406\u8bf7\u6c42\u7684\u5b9e\u9645\u8fdb\u7a0b&#xff0c;\u6bcf\u4e2a\u5de5\u4f5c\u8fdb\u7a0b\u53ef\u4ee5\u72ec\u7acb\u5904\u7406\u8bf7\u6c42\u3002\u8bbe\u7f6e\u4e3a1\u610f\u5473\u7740\u6240\u6709\u8bf7\u6c42\u90fd\u7531\u5355\u4e2a\u5de5\u4f5c\u8fdb\u7a0b\u5904\u7406\u3002)\u3002<\/li>\n<li>events\u5757&#xff1a;\u914d\u7f6e\u5f71\u54cdnginx\u670d\u52a1\u5668\u6216\u4e0e\u7528\u6237\u7684\u7f51\u7edc\u8fde\u63a5\u3002\u6709\u6bcf\u4e2a\u8fdb\u7a0b\u7684\u6700\u5927\u8fde\u63a5\u6570&#xff0c;\u9009\u53d6\u54ea\u79cd\u4e8b\u4ef6\u9a71\u52a8\u6a21\u578b\u5904\u7406\u8fde\u63a5\u8bf7\u6c42&#xff0c;\u662f\u5426\u5141\u8bb8\u540c\u65f6\u63a5\u53d7\u591a\u4e2a\u7f51\u8def\u8fde\u63a5&#xff0c;\u5f00\u542f\u591a\u4e2a\u7f51\u7edc\u8fde\u63a5\u5e8f\u5217\u5316\u7b49\u3002<\/li>\n<li>http\u5757&#xff1a;\u53ef\u4ee5\u5d4c\u5957\u591a\u4e2aserver&#xff0c;\u914d\u7f6e\u4ee3\u7406&#xff0c;\u7f13\u5b58&#xff0c;\u65e5\u5fd7\u5b9a\u4e49\u7b49\u7edd\u5927\u591a\u6570\u529f\u80fd\u548c\u7b2c\u4e09\u65b9\u6a21\u5757\u7684\u914d\u7f6e\u3002\u5982\u6587\u4ef6\u5f15\u5165&#xff0c;mime-type\u5b9a\u4e49&#xff0c;\u65e5\u5fd7\u81ea\u5b9a\u4e49&#xff0c;\u662f\u5426\u4f7f\u7528sendfile\u4f20\u8f93\u6587\u4ef6&#xff0c;\u8fde\u63a5\u8d85\u65f6\u65f6\u95f4&#xff0c;\u5355\u8fde\u63a5\u8bf7\u6c42\u6570\u7b49\u3002<\/li>\n<li>server\u5757&#xff1a;\u914d\u7f6e\u865a\u62df\u4e3b\u673a\u7684\u76f8\u5173\u53c2\u6570&#xff0c;\u4e00\u4e2ahttp\u4e2d\u53ef\u4ee5\u6709\u591a\u4e2aserver\u3002<\/li>\n<li>location\u5757&#xff1a;\u914d\u7f6e\u8bf7\u6c42\u7684\u8def\u7531&#xff0c;\u4ee5\u53ca\u5404\u79cd\u9875\u9762\u7684\u5904\u7406\u60c5\u51b5\u3002<\/li>\n<\/ul>\n<p>\u518d\u901a\u8fc7\u4e00\u4e2a\u5b9e\u9645\u4f8b\u5b50\u5177\u4f53\u8bf4\u660e<\/p>\n<p>########### \u6bcf\u4e2a\u6307\u4ee4\u5fc5\u987b\u6709\u5206\u53f7\u7ed3\u675f\u3002#################<br \/>\n#user administrator administrators;  #\u914d\u7f6e\u7528\u6237\u6216\u8005\u7ec4&#xff0c;\u9ed8\u8ba4\u4e3anobody nobody\u3002<br \/>\n#worker_processes 2;  #\u5141\u8bb8\u751f\u6210\u7684\u8fdb\u7a0b\u6570&#xff0c;\u9ed8\u8ba4\u4e3a1<br \/>\n#pid \/nginx\/pid\/nginx.pid;   #\u6307\u5b9anginx\u8fdb\u7a0b\u8fd0\u884c\u6587\u4ef6\u5b58\u653e\u5730\u5740<br \/>\nerror_log log\/error.log debug;  #\u5236\u5b9a\u65e5\u5fd7\u8def\u5f84&#xff0c;\u7ea7\u522b\u3002\u8fd9\u4e2a\u8bbe\u7f6e\u53ef\u4ee5\u653e\u5165\u5168\u5c40\u5757&#xff0c;http\u5757&#xff0c;server\u5757&#xff0c;\u7ea7\u522b\u4ee5\u6b64\u4e3a&#xff1a;debug|info|notice|warn|error|crit|alert|emerg<br \/>\nevents {<br \/>\n    accept_mutex on;   #\u8bbe\u7f6e\u7f51\u8def\u8fde\u63a5\u5e8f\u5217\u5316&#xff0c;\u9632\u6b62\u60ca\u7fa4\u73b0\u8c61\u53d1\u751f&#xff0c;\u9ed8\u8ba4\u4e3aon<br \/>\n    multi_accept on;  #\u8bbe\u7f6e\u4e00\u4e2a\u8fdb\u7a0b\u662f\u5426\u540c\u65f6\u63a5\u53d7\u591a\u4e2a\u7f51\u7edc\u8fde\u63a5&#xff0c;\u9ed8\u8ba4\u4e3aoff<br \/>\n    #use epoll;      #\u4e8b\u4ef6\u9a71\u52a8\u6a21\u578b&#xff0c;select|poll|kqueue|epoll|resig|\/dev\/poll|eventport<br \/>\n    worker_connections  1024;    #\u6700\u5927\u8fde\u63a5\u6570&#xff0c;\u9ed8\u8ba4\u4e3a512<br \/>\n}<br \/>\nhttp {<br \/>\n    include       mime.types;   #\u6587\u4ef6\u6269\u5c55\u540d\u4e0e\u6587\u4ef6\u7c7b\u578b\u6620\u5c04\u8868<br \/>\n    default_type  application\/octet-stream; #\u9ed8\u8ba4\u6587\u4ef6\u7c7b\u578b&#xff0c;\u9ed8\u8ba4\u4e3atext\/plain<br \/>\n    #access_log off; #\u53d6\u6d88\u670d\u52a1\u65e5\u5fd7<br \/>\n    log_format myFormat &#039;$remote_addr\u2013$remote_user [$time_local] $request $status $body_bytes_sent $http_referer $http_user_agent $http_x_forwarded_for&#039;; #\u81ea\u5b9a\u4e49\u683c\u5f0f<br \/>\n    access_log log\/access.log myFormat;  #combined\u4e3a\u65e5\u5fd7\u683c\u5f0f\u7684\u9ed8\u8ba4\u503c<br \/>\n    sendfile on;   #\u5141\u8bb8sendfile\u65b9\u5f0f\u4f20\u8f93\u6587\u4ef6&#xff0c;\u9ed8\u8ba4\u4e3aoff&#xff0c;\u53ef\u4ee5\u5728http\u5757&#xff0c;server\u5757&#xff0c;location\u5757\u3002<br \/>\n    sendfile_max_chunk 100k;  #\u6bcf\u4e2a\u8fdb\u7a0b\u6bcf\u6b21\u8c03\u7528\u4f20\u8f93\u6570\u91cf\u4e0d\u80fd\u5927\u4e8e\u8bbe\u5b9a\u7684\u503c&#xff0c;\u9ed8\u8ba4\u4e3a0&#xff0c;\u5373\u4e0d\u8bbe\u4e0a\u9650\u3002<br \/>\n    keepalive_timeout 65;  #\u8fde\u63a5\u8d85\u65f6\u65f6\u95f4&#xff0c;\u9ed8\u8ba4\u4e3a75s&#xff0c;\u53ef\u4ee5\u5728http&#xff0c;server&#xff0c;location\u5757\u3002<\/p>\n<p>    upstream mysvr {<br \/>\n      server 127.0.0.1:7878;<br \/>\n      server 192.168.10.121:3333 backup;  #\u70ed\u5907<br \/>\n    }<br \/>\n    error_page 404 https:\/\/www.baidu.com; #\u9519\u8bef\u9875<br \/>\n    server {<br \/>\n        keepalive_requests 120; #\u5355\u8fde\u63a5\u8bf7\u6c42\u4e0a\u9650\u6b21\u6570\u3002<br \/>\n        listen       4545;   #\u76d1\u542c\u7aef\u53e3<br \/>\n        server_name  127.0.0.1;   #\u76d1\u542c\u5730\u5740<br \/>\n        location  ~*^.&#043;$ {       #\u8bf7\u6c42\u7684url\u8fc7\u6ee4&#xff0c;\u6b63\u5219\u5339\u914d&#xff0c;~\u4e3a\u533a\u5206\u5927\u5c0f\u5199&#xff0c;~*\u4e3a\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u3002<br \/>\n           #root path;  #\u6839\u76ee\u5f55<br \/>\n           #index vv.txt;  #\u8bbe\u7f6e\u9ed8\u8ba4\u9875<br \/>\n           proxy_pass  http:\/\/mysvr;  #\u8bf7\u6c42\u8f6c\u5411mysvr \u5b9a\u4e49\u7684\u670d\u52a1\u5668\u5217\u8868<br \/>\n           deny 127.0.0.1;  #\u62d2\u7edd\u7684ip<br \/>\n           allow 172.18.5.54; #\u5141\u8bb8\u7684ip<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<h2>\u5b89\u88c5\u5e76\u90e8\u7f72\u4f60\u7684\u9759\u6001\u7f51\u9875<\/h2>\n<p>\u8a00\u5f52\u6b63\u4f20,\u4e86\u89e3\u4e86Nginx\u7684\u57fa\u672c\u77e5\u8bc6,\u63a5\u4e0b\u6765\u6211\u4eec\u5f00\u59cb\u6b63\u5f0f\u5b89\u88c5\u5e76\u90e8\u7f72\u4f60\u7684\u7b2c\u4e00\u4e2a\u9759\u6001\u7f51\u9875!(\u672c\u6559\u7a0b\u57fa\u4e8eCentOS7&#043;\u5b9d\u5854)<\/p>\n<h3>1. \u5b89\u88c5(\u61d2\u4eba\u76f4\u63a5\u770b3)<\/h3>\n<p>(1) \u5b98\u7f51\u5b89\u88c5\u5e76\u89e3\u538b<\/p>\n<p>nginx: download<\/p>\n<p>\u7b2c\u4e00\u6b65:\u4e0b\u8f7dnginx \u8fd9\u91cc\u4ee51.6.2\u7248\u672c\u4e3a\u4f8b<br \/>\n\u7b2c\u4e8c\u6b65:\u5171\u4eab\u5b89\u88c5\u6587\u4ef6\u5230\u6211\u4eec\u7684linux\u4e0a\u9762<br \/>\n\u7b2c\u4e09\u6b65:\u5c06\u6587\u4ef6\u62f7\u8d1d\u5230\/usr\/local\u4e0b\u9762<br \/>\n\u7b2c\u56db\u6b65:\u5b89\u88c5 <span class=\"token function\">tar<\/span> <span class=\"token parameter variable\">-zxvf<\/span> xxxx.tar.gz<br \/>\n\u7b2c\u4e94\u6b65:\u4e0b\u8f7d\u6240\u9700\u8981\u7684\u4f9d\u8d56\u5e93 yum <span class=\"token function\">install<\/span> pcre  yum <span class=\"token function\">install<\/span> pcre-devel  yum <span class=\"token function\">install<\/span> zlib   yum <span class=\"token function\">install<\/span> zlib-devel<br \/>\n\u7b2c\u516d\u6b65:\u8fdb\u884cconfig\u7684\u914d\u7f6e<br \/>\n<span class=\"token builtin class-name\">cd<\/span> nginx-1.6.2 <span class=\"token operator\">&amp;&amp;<\/span> .\/configure <span class=\"token parameter variable\">&#8211;prefix<\/span><span class=\"token operator\">&#061;<\/span>\/usr\/local\/nginx<br \/>\n\u7b2c\u4e03\u6b65:\u5b89\u88c5<br \/>\n<span class=\"token function\">make<\/span> <span class=\"token operator\">&amp;&amp;<\/span> <span class=\"token function\">make<\/span> <span class=\"token function\">install<\/span> <\/p>\n<p>(2) \u547d\u4ee4\u884c\u5b89\u88c5<\/p>\n<p># Centos<br \/>\nsudo yum install nginx -y<\/p>\n<p>(3) \u5b9d\u5854\u9762\u677f(\u65b0\u624b\u53cb\u597d)<\/p>\n<p>\u5b9d\u5854\u9762\u677f &#8211; \u7b80\u5355\u597d\u7528\u7684Linux\/Windows\u670d\u52a1\u5668\u8fd0\u7ef4\u7ba1\u7406\u9762\u677f (bt.cn)<\/p>\n<p>url&#061;https:\/\/download.bt.cn\/install\/install_lts.sh;if [ -f \/usr\/bin\/curl ];then curl -sSO $url;else wget -O install_lts.sh $url;fi;bash install_lts.sh ed8484bec<\/p>\n<p>\u547d\u4ee4\u884c\u5b89\u88c5\u5b9d\u5854\u5e76\u914d\u7f6e\u540e,\u76f4\u63a5\u5728\u5b9d\u5854\u9762\u677f\u8fdb\u884c\u65e0\u8111\u5b89\u88c5<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418114739-68023bdb98265.png\" alt=\"img\" \/><\/p>\n<p>\u5b89\u88c5\u540e\u4f1a\u81ea\u52a8\u8fd0\u884c,\u5f53\u7136\u4e5f\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u8fd0\u884c<\/p>\n<p><span class=\"token comment\"># \u68c0\u67e5nginx\u914d\u7f6e\u7684\u8bed\u6cd5\u662f\u5426\u6ca1\u6709\u9519\u8bef<\/span><br \/>\n<span class=\"token function\">sudo<\/span> nginx <span class=\"token parameter variable\">-t<\/span> <\/p>\n<p><span class=\"token comment\"># \u542f\u52a8<\/span><br \/>\n<span class=\"token function\">sudo<\/span> systemctl start nginx<\/p>\n<p><span class=\"token comment\"># \u91cd\u542f<\/span><br \/>\n<span class=\"token function\">sudo<\/span> systemctl restart nginx<\/p>\n<p><span class=\"token comment\"># \u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6<\/span><br \/>\n<span class=\"token function\">sudo<\/span> nginx <span class=\"token parameter variable\">-s<\/span> reload<\/p>\n<h3>2.\u67e5\u770b\u914d\u7f6e\u6587\u4ef6<\/h3>\n<p>\u53ef\u4ee5\u76f4\u63a5\u641c\u7d22\u914d\u7f6e\u6587\u4ef6\u7684\u4f4d\u7f6e,\u907f\u514d\u56e0\u4e3a\u5b89\u88c5\u65b9\u5f0f\u4e0d\u540c\u627e\u4e0d\u5230<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;123 local<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># find \/ -name &#039;nginx.conf&#039;<\/span><br \/>\n\/www\/server\/nginx\/conf\/nginx.conf<br \/>\n\/www\/backup\/file_history\/www\/server\/nginx\/conf\/nginx.conf<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;123 local<span class=\"token punctuation\">]<\/span><span class=\"token comment\">#cd \/www\/server\/nginx\/conf<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;123 conf<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># vim nginx.conf<\/span><\/p>\n<p>\u6211\u4eec\u76f4\u63a5\u4fc4\u5b9a\u4f4d\u5230http\u4e2d\u7684server\u4e0a\u4e0b\u6587<\/p>\n<p>server<br \/>\n    {<br \/>\n        listen 888;<br \/>\n        server_name myadmin;<br \/>\n        index index.html index.htm index.php;<br \/>\n        root  \/www\/server\/nginx\/html;<\/p>\n<p>        #error_page   404   \/404.html;<br \/>\n        include enable-php.conf;<\/p>\n<p>        location ~ .*\\\\.(gif|jpg|jpeg|png|bmp|swf)$<br \/>\n        {<br \/>\n            expires      30d;<br \/>\n        }<\/p>\n<p>        location ~ .*\\\\.(js|css)?$<br \/>\n        {<br \/>\n            expires      12h;<br \/>\n        }<\/p>\n<p>        location ~ \/\\\\.<br \/>\n        {<br \/>\n            deny all;<br \/>\n        }<\/p>\n<p>        access_log  \/www\/wwwlogs\/access.log;<br \/>\n    }<\/p>\n<h3>3.\u7f16\u5199\u6216\u653e\u5165\u81ea\u5df1\u7684\u9759\u6001\u9875\u9762\u6587\u4ef6<\/h3>\n<p>\u5c06 root \u4e2d\u7684\u8def\u5f84\u6539\u4e3a\u81ea\u5df1\u5b9e\u9645\u5b58\u50a8\u9759\u6001\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55,\u7aef\u53e3\u6309\u7167\u9700\u8981\u4fee\u6539\u4e3a\u5df2\u5f00\u653e\u7684\u5b89\u5168\u7ec4,\u63a8\u8350\u4e3a80\u7aef\u53e3<\/p>\n<p>\u4e00\u5207\u51c6\u5907\u5c31\u7eea\u540e,\u6211\u4eec\u5c31\u53ef\u4ee5\u901a\u8fc7 curl 127.0.0.1\u67e5\u770b\u81ea\u5df1\u7684\u7f51\u9875\u662f\u5426\u53ef\u4ee5\u6b63\u5e38\u83b7\u53d6\u4e86<\/p>\n<p>\u793a\u4f8b\u914d\u7f6e\u9879<\/p>\n<p>server<br \/>\n    {<br \/>\n        listen 888;<br \/>\n        server_name phpmyadmin;<br \/>\n        index index.html index.htm index.php;<br \/>\n        root  \/www\/server\/nginx\/html;<\/p>\n<p>        #error_page   404   \/404.html;<br \/>\n        include enable-php.conf;<\/p>\n<p>        location ~ .*\\\\.(gif|jpg|jpeg|png|bmp|swf)$<br \/>\n        {<br \/>\n            expires      30d;<br \/>\n        }<\/p>\n<p>        location ~ .*\\\\.(js|css)?$<br \/>\n        {<br \/>\n            expires      12h;<br \/>\n        }<\/p>\n<p>        location ~ \/\\\\.<br \/>\n        {<br \/>\n            deny all;<br \/>\n        }<\/p>\n<p>        access_log  \/www\/wwwlogs\/access.log;<br \/>\n    }<\/p>\n<p>index.html\u9875\u5185\u5bb9<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418114740-68023bdcc724b.png\" alt=\"img\" \/><\/p>\n<p>\u672c\u5730\u8bbf\u95ee\u6d4b\u8bd5\u6210\u529f<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418114743-68023bdf39d47.png\" alt=\"img\" \/><\/p>\n<p>\u4e0a\u7ebf\u6548\u679c<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418114745-68023be1a3764.png\" alt=\"img\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.9k\u6b21\uff0c\u70b9\u8d5e19\u6b21\uff0c\u6536\u85cf17\u6b21\u3002\u4e00\u6587\u5e26\u4f60\u5229\u7528Nginx\u5728\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u7b2c\u4e00\u4e2a\u9759\u6001\u9875\u9762_nginx\u914d\u7f6e\u9759\u6001\u9875\u9762<\/p>\n","protected":false},"author":2,"featured_media":12707,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[720,58,117,594,719,43],"topic":[],"class_list":["post-12715","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-dubbo","tag-linux","tag-nginx","tag-web","tag-719","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5229\u7528Nginx\u5728\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u4f60\u7684\u7b2c\u4e00\u4e2a\u9759\u6001\u9875\u9762 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/12715.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5229\u7528Nginx\u5728\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u4f60\u7684\u7b2c\u4e00\u4e2a\u9759\u6001\u9875\u9762 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.9k\u6b21\uff0c\u70b9\u8d5e19\u6b21\uff0c\u6536\u85cf17\u6b21\u3002\u4e00\u6587\u5e26\u4f60\u5229\u7528Nginx\u5728\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u7b2c\u4e00\u4e2a\u9759\u6001\u9875\u9762_nginx\u914d\u7f6e\u9759\u6001\u9875\u9762\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/12715.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T11:47:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418114737-68023bd9e400c.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/12715.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/12715.html\",\"name\":\"\u5229\u7528Nginx\u5728\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u4f60\u7684\u7b2c\u4e00\u4e2a\u9759\u6001\u9875\u9762 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T11:47:47+00:00\",\"dateModified\":\"2025-04-18T11:47:47+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/12715.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/12715.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/12715.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5229\u7528Nginx\u5728\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u4f60\u7684\u7b2c\u4e00\u4e2a\u9759\u6001\u9875\u9762\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5229\u7528Nginx\u5728\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u4f60\u7684\u7b2c\u4e00\u4e2a\u9759\u6001\u9875\u9762 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/12715.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5229\u7528Nginx\u5728\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u4f60\u7684\u7b2c\u4e00\u4e2a\u9759\u6001\u9875\u9762 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.9k\u6b21\uff0c\u70b9\u8d5e19\u6b21\uff0c\u6536\u85cf17\u6b21\u3002\u4e00\u6587\u5e26\u4f60\u5229\u7528Nginx\u5728\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u7b2c\u4e00\u4e2a\u9759\u6001\u9875\u9762_nginx\u914d\u7f6e\u9759\u6001\u9875\u9762","og_url":"https:\/\/www.wsisp.com\/helps\/12715.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T11:47:47+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418114737-68023bd9e400c.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/12715.html","url":"https:\/\/www.wsisp.com\/helps\/12715.html","name":"\u5229\u7528Nginx\u5728\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u4f60\u7684\u7b2c\u4e00\u4e2a\u9759\u6001\u9875\u9762 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T11:47:47+00:00","dateModified":"2025-04-18T11:47:47+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/12715.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/12715.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/12715.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5229\u7528Nginx\u5728\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u4f60\u7684\u7b2c\u4e00\u4e2a\u9759\u6001\u9875\u9762"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/12715","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=12715"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/12715\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/12707"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=12715"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=12715"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=12715"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=12715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}