{"id":545,"date":"2022-02-09T21:44:43","date_gmt":"2022-02-09T13:44:43","guid":{"rendered":"https:\/\/www.buyao007.icu\/?p=545"},"modified":"2022-02-17T10:13:02","modified_gmt":"2022-02-17T02:13:02","slug":"2-nginx%e7%9a%84web%e6%9c%8d%e5%8a%a1%e5%bf%ab%e9%80%9f%e5%85%a5%e9%97%a8","status":"publish","type":"post","link":"https:\/\/www.buyao007.icu\/?p=545","title":{"rendered":"2.nginx\u7684web\u670d\u52a1\u5feb\u901f\u5165\u95e8"},"content":{"rendered":"\n<p>\u5b59\u5bcc\u9633\uff0c \u6c5f\u6e56\u4eba\u79f0\u6ca1\u4eba\u79f0\u3002\u591a\u5e74\u4e92\u8054\u7f51\u8fd0\u7ef4\u5de5\u4f5c\u7ecf\u9a8c\uff0c\u66fe\u8d1f\u8d23\u8fc7\u5b59\u5e03\u65af\u5927\u89c4\u6a21\u96c6\u7fa4\u67b6\u6784\u81ea\u52a8\u5316\u8fd0\u7ef4\u7ba1\u7406\u5de5\u4f5c\u3002\u64c5\u957fWeb\u96c6\u7fa4\u67b6\u6784\u4e0e\u81ea\u52a8\u5316\u8fd0\u7ef4\uff0c\u66fe\u8d1f\u8d23\u56fd\u5185\u67d0\u5927\u578b\u535a\u5ba2\u7f51\u7ad9\u8fd0\u7ef4\u5de5\u4f5c\u3002\u5fae\u4fe1\uff1as2795802440<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc_0\">1.nginx\u57fa\u672c\u6982\u8ff0<\/h2>\n\n\n\n<p><strong><em>1.\u4ec0\u4e48\u662fnginx<\/em><\/strong><\/p>\n\n\n\n<p>nginx\u662f\u4e00\u4e2a\u5f00\u6e90\u4e14\u9ad8\u6027\u80fd\u3001\u9ad8\u53ef\u9760\u7684Http Web\u670d\u52a1\uff08\u89e3\u6790\u9759\u6001\u8d44\u6e90\uff09\u3001\u4ee3\u7406\u670d\u52a1\uff08\u4f8b\u5982\u4ee3\u7406PHP\u3001\u4ee3\u7406java\uff09\u3002<br>\u5f00\u6e90\uff0c\u53ef\u4ee5\u76f4\u63a5\u83b7\u53d6nginx\u7684\u6e90\u4ee3\u7801<br>\u9ad8\u6027\u80fd\uff0c\u652f\u6301\u6d77\u91cf\u5e76\u53d1<br>\u9ad8\u53ef\u9760\uff0c\u670d\u52a1\u7a33\u5b9a<\/p>\n\n\n\n<p><strong><em>2.\u4e3a\u4ec0\u4e48\u9009\u62e9nginx<\/em><\/strong><\/p>\n\n\n\n<p>1.\u9ad8\u6027\u80fd\u3001\u9ad8\u5e76\u53d1<br>\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u5355\u8bcd\u8bf7\u6c42\u4f1a\u5f97\u5230\u66f4\u5feb\u7684\u54cd\u5e94\u3002\u53e6\u4e00\u65b9\u9762\u5728\u9ad8\u5cf0\u671f\uff08\u5982\u6709\u6570\u4ee5\u4e07\u8ba1\u7684\u5e76\u53d1\u8bf7\u6c42\uff09\uff0cnginx\u53ef\u4ee5\u6bd4\u5176\u4ed6web\u670d\u52a1\u66f4\u5feb\u7684\u54cd\u5e94\u8bf7\u6c42\u3002<\/p>\n\n\n\n<p>2.\u9ad8\u6269\u5c55\u6027<br>Nginx\u529f\u80fd\u6a21\u5757\u5316\u3002nginx\u5b98\u65b9\u63d0\u4f9b\u4e86\u975e\u5e38\u591a\u7684\u4f18\u79c0\u6a21\u5757\u63d0\u4f9b\u4f7f\u7528\u3002\u8fd9\u4e9b\u6a21\u5757\u90fd\u53ef\u4ee5\u5b9e\u73b0\u5feb\u901f\u589e\u52a0\u548c\u51cf\u5c11\u3002<\/p>\n\n\n\n<p>3.\u9ad8\u53ef\u9760\u6027<br>\u6240\u8c13\u9ad8\u53ef\u9760\u6027\uff0c\u662f\u6307Nginx\u53ef\u4ee5\u5728\u670d\u52a1\u5668\u4e0a\u6301\u7eed\u4e0d\u95f4\u65ad\u7684\u8fd0\u884c\uff0c\u800c\u5f88\u591aweb\u670d\u52a1\u5668\u5f80\u5f80\u8fd0\u884c\u51e0\u5468\u6216\u51e0\u4e2a\u6708\u5c31\u9700\u8981\u8fdb\u884c\u4e00\u6b21\u91cd\u542f\u3002\u5bf9\u4e8eNginx\u8fd9\u6837\u7684\u4e00\u4e2a\u9ad8\u5e76\u53d1\u3001\u9ad8\u6027\u80fd\u7684\u53cd\u5411\u4ee3\u7406\u670d\u52a1\u5668\u800c\u8a00\uff0c\u4ed6\u5f80\u5f80\u8fd0\u884c\u7f51\u7ad9\u67b6\u6784\u7684\u6700\u524d\u7aef\uff0c\u90a3\u4e48\u6b64\u65f6\u5982\u679c\u6211\u4eec\u4f01\u4e1a\u60f3\u63d0\u4f9b9999.99999\u7684\u53ef\u9760\u6027\uff0c\u5bf9\u4e8enginx\u6301\u7eed\u8fd0\u884c\u80fd\u591f\u5b95\u673a\u7684\u65f6\u95f4\uff0c\u4e00\u5e74\u53ef\u80fd\u53ea\u80fd\u4ee5\u79d2\u6765\u8ba1\u7b97\uff0c\u6240\u4ee5\u5728\u8fd9\u6837\u7684\u4e00\u4e2a\u89d2\u8272\u4e2d\uff0cnginx\u7684\u9ad8\u53ef\u9760\u6027\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u975e\u5e38\u597d\u7684\u4fdd\u8bc1\u3002<\/p>\n\n\n\n<p>4.\u70ed\u90e8\u7f72<br>\u70ed\u90e8\u7f72\u662f\u6307\u5728\u4e0d\u505c\u6b62\u670d\u52a1\u7684\u60c5\u51b5\u4e0b\u5347\u7ea7nginx\uff0c\u8fd9\u4e2a\u529f\u80fd\u975e\u5e38\u91cd\u8981\u3002\u5bf9\u4e8e\u666e\u901a\u7684\u670d\u52a1\uff0c\u53ea\u9700\u8981kill\u6389\u8fdb\u7a0b\u5728\u542f\u52a8\uff0c\u4f46\u662f\u5bf9\u4e8enginx\u800c\u8a00\uff0c\u5982\u679cnginx\u6709\u5f88\u591a\u7684\u5ba2\u6237\u7aef\u8fde\u63a5\uff0c\u90a3\u4e48kill\u6389nginx\u3002nginx\u4f1a\u5411\u5ba2\u6237\u7aef\u53d1\u9001tcp reset\u590d\u4f4d\u5305\uff0c\u4f46\u5f88\u591a\u5ba2\u6237\u7aef\u65e0\u6cd5\u5f88\u597d\u7684\u7406\u89e3reset\u5305\uff0c\u5c31\u4f1a\u9020\u6210\u5f02\u5e38\u3002\u7531\u4e8eNginx\u7684master\u7ba1\u7406\u8fdb\u7a0b\u4e0eworker\u5de5\u4f5c\u8fdb\u7a0b\u7684\u5206\u79bb\u8bbe\u8ba1\uff0c\u4f7f\u5f97nginx\u80fd\u591f\u5728\u4e0d\u95f4\u65ad\u670d\u52a1\u7684\u524d\u63d0\u4e0b\uff0c\u5347\u7ea7Nginx\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002\u5f53\u7136\uff0c\u4e5f\u652f\u6301\u4e0d\u505c\u6b62\u670d\u52a1\u66f4\u65b0\u914d\u7f6e\u3001\u66f4\u6362\u65e5\u5fd7\u6587\u4ef6\u7b49\u529f\u80fd\u3002<\/p>\n\n\n\n<p>5.\u4e92\u8054\u7f51\u516c\u53f8\u90fd\u9009\u62e9Nginx<br>\u9996\u5148nginx\u6280\u672f\u6210\u719f\uff0c\u5177\u5907\u4f01\u4e1a\u6700\u5e38\u7528\u7684\u529f\u80fd\uff0c\u5982\u4ee3\u7406\u3001\u7f13\u5b58\u3001\u8d1f\u8f7d\u5747\u8861\u3001\u52a8\u9759\u5206\u79bb\u3001https\u3001lnmp\u3001lnmt\u7b49\u7b49<br>\u5176\u6b21\u662f\u54e6\u4e5f\u80fd\u591fnginx\u7edf\u4e00\u6280\u672f\u6808\uff0c\u964d\u4f4e\u7ef4\u62a4\u6210\u672c\uff0c\u540c\u65f6\u964d\u4f4e\u6280\u672f\u66f4\u65b0\u6210\u672c\u3002<\/p>\n\n\n\n<p>6.nginx\u4f7f\u7528epool\u7f51\u7edc\u6a21\u578b\uff0c\u800c\u5e38\u542c\u5230\u7684Apache\u91c7\u7528\u7684\u662fselect\u7f51\u7edc\u6a21\u578b<br>select\uff1a\u5f53\u7528\u6237\u53d1\u8d77\u4e00\u6b21\u8bf7\u6c42\uff0cselect\u6a21\u578b\u5c31\u4f1a\u8fdb\u884c\u4e00\u6b21\u904d\u5386\u626b\u63cf\uff0c\u4ece\u800c\u5bfc\u81f4\u6027\u80fd\u4f4e\u4e0b\u3002<br>epoll\uff1a\u5f53\u7528\u6237\u53d1\u8d77\u8bf7\u6c42\uff0cepoll\u6a21\u578b\u4f1a\u76f4\u63a5\u8fdb\u884c\u5904\u7406\uff0c\u6548\u7387\u66f4\u9ad8\u6548<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc_0\">2.nginx\u5e94\u7528\u573a\u666f<\/h2>\n\n\n\n<p>Nginx\u7684\u4e3b\u8981\u4f7f\u7528\u573a\u666f\u6211\u5f52\u7eb3\u4e3a\u4e09\u4e2a\uff0c\u5206\u4e3a\u662f\u9759\u6001\u8d44\u6e90\u670d\u52a1\u3001\u4ee3\u7406\u8d44\u6e90\u670d\u52a1\u3001\u5b89\u5168\u670d\u52a1\uff0c\u573a\u666f\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4e0b<\/p>\n\n\n\n<p>\u5982\u4e0b\u56fe\u662f\u4e00\u4e2a\u7f51\u7ad9\u7684\u57fa\u672c\u67b6\u6784\uff0c\u9996\u5148\u7528\u6237\u8bf7\u6c42\u5148\u5230\u8fbenginx\uff0c\u7136\u540e\u5728\u5230tomcatphp\u8fd9\u6837\u7684\u5e94\u7528\u670d\u52a1\u5668\uff0c\u7136\u540e\u5e94\u7528\u670d\u52a1\u5668\u5728\u53bb\u8bbf\u95eeredis\u3001mysql\u8fd9\u6837\u7684\u6570\u636e\u5e93\uff0c\u63d0\u4f9b\u57fa\u672c\u7684\u6570\u636e\u529f\u80fd\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"716\" height=\"240\" src=\"https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-8.png\" alt=\"\" class=\"wp-image-558\" srcset=\"https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-8.png 716w, https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-8-300x101.png 300w\" sizes=\"(max-width: 716px) 100vw, 716px\" \/><\/figure>\n\n\n\n<p>\u90a3\u4e48\u8fd9\u91cc\u6709\u4e00\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u7684\u7a0b\u5e8f\u4ee3\u7801\u8981\u6c42\u5f00\u53d1\u6548\u7387\u9ad8\uff0c\u6240\u4ee5\u4ed6\u7684\u8fd0\u884c\u6548\u7387\u662f\u5f88\u4f4e\u7684\uff0c\u6216\u8005\u8bf4\u5b83\u5e76\u53d1\u662f\u53d7\u9650\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u5f88\u591a\u5e94\u7528\u670d\u52a1\u7ec4\u6210\u4e00\u4e2a\u96c6\u7fa4\uff0c\u4e3a\u66f4\u591a\u7528\u6237\u63d0\u4f9b\u8bbf\u95ee\u3002<\/p>\n\n\n\n<p>\u800c\u5e94\u7528\u670d\u52a1\u4e00\u4f46\u6784\u6210\u96c6\u7fa4\uff0c\u5219\u9700\u8981\u6211\u4eec\u7684nginx\u5177\u6709\u53cd\u5411\u4ee3\u7406\u529f\u80fd\uff0c\u8fd9\u6837\u53ef<em>\u4ee5\u5c06\u52a8\u6001\u8bf7\u6c42\u4f20\u5012\u7ed9\u96c6\u7fa4\u670d\u52a1\u3002<\/em><\/p>\n\n\n\n<p>\u4f46\u5f88\u591a\u5e94\u7528\u6784\u6210\u96c6\u7fa4\uff0c\u90a3\u4e48\u4e00\u5b9a\u4f1a\u5e26\u6765\u4e24\u4e2a\u9700\u6c42\u3002\u2003 \u20031\u3001\u5e94\u7528\u670d\u52a1\u5668\u9700\u8981\u52a8\u6001\u6269\u5c55\u3002\u2003 \u20032\u3001\u6709\u4e9b\u670d\u52a1\u51fa\u95ee\u9898\u9700\u8981\u505a\u5bb9\u707e\u3002\u90a3\u4e48\u6211\u4eec\u7684\u53cd\u5411\u4ee3\u7406\u5fc5\u987b\u5177\u5907\u8d1f\u8f7d\u5747\u8861\u529f\u80fd\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"739\" height=\"413\" src=\"https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-9.png\" alt=\"\" class=\"wp-image-559\" srcset=\"https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-9.png 739w, https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-9-300x168.png 300w\" sizes=\"(max-width: 739px) 100vw, 739px\" \/><\/figure>\n\n\n\n<p><em>\u5176\u6b21\uff0c\u968f\u7740\u6211\u4eec\u7f51\u7edc\u94fe\u8def\u7684\u589e\u957f\uff0c\u7528\u6237\u4f53\u9a8c\u5230\u7684\u65f6\u5ef6\u5219\u4f1a\u589e\u52a0\u3002\u5982\u679c\u6211\u4eec\u80fd\u628a\u4e00\u6bb5\u65f6\u95f4\u5185\u4e0d\u4f1a\u53d1\u751f\u53d8\u5316\u7684'\u52a8\u6001'\u5185\u5bb9\uff0c\u7f13\u5b58\u5728Nginx\uff0c\u7531Nginx\u76f4\u63a5\u5411\u7528\u6237\u63d0\u4f9b\u8bbf\u53ef\uff0c\u90a3\u4e48\u8fd9\u6837\u7528\u6237\u8bf7\u6c42\u7684\u65f6\u5ef6\u5c31\u4f1a\u51cf\u5c11\u5f88\u591a\uff0c\u6240\u4ee5\u5728\u8fd9\u91cc\u53cd\u5411\u4ee3\u7406\u4f1a\u6f14\u751f\u51fa\u53e6\u5916\u4e00\u4e2a\u529f\u80fd\"\u7f13\u5b58'\uff0c\u56e0\u4e3a\u5b83\u80fd\u52a0\u901f\u6211\u4eec\u7684\u8bbf\u95ee\u3002<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"703\" height=\"385\" src=\"https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-10.png\" alt=\"\" class=\"wp-image-560\" srcset=\"https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-10.png 703w, https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-10-300x164.png 300w\" sizes=\"(max-width: 703px) 100vw, 703px\" \/><figcaption><em>\u5728\u5f88\u591a\u65f6\u5019\u6211\u4eec\u8bbf\u95eedocs\u3001pdf\u3001mp4\u3001png\u7b49\u8fd9\u6837\u7684\u9759\u6001\u8d44\u6e90\u65f6\uff0c\u662f\u6ca1\u6709\u5fc5\u8981\u5c06\u8fd9\u4e9b\u8bf7\u6c42\u901a\u8fc7Nginx\u4ea4\u7ed9\u540e\u7aef\u7684\u5e94\u7528\u670d\u52a1\uff0c\u6211\u4eec\u53ea\u9700\u8981\u901a\u8fc7Nginx\u76f4\u63a5\u5904\u7406'\u9759\u6001\u8d44\u6f2f'\u5373\u53ef\u3002\u8fd9\u662fNginx\u7684\u9759\u6001\u8d44\u6e90\u529f\u80fd\u3002<\/em><\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"755\" height=\"372\" src=\"https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-12.png\" alt=\"\" class=\"wp-image-562\" srcset=\"https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-12.png 755w, https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-12-300x148.png 300w\" sizes=\"(max-width: 755px) 100vw, 755px\" \/><figcaption><em>\u5f53\u6211\u4eec\u4f7f\u7528http\u7f51\u7ad9\u65f6\uff0c\u53ef\u80fd\u4f1a\u906d\u5230\u548c\u7be1\u6539\uff0c\u5982\u679c\u4f7f\u7528https\u5b89\u5168\u901a\u8baf\u534f\u8bae\uff0c\u90a3\u4e48\u6570\u636e\u5728\u4f20\u8f93\u8fc7\u7a0b\u4e2d\u662f\u52a0\u5bc6\u7684\uff0c\u4ece\u800c\u80fd\u6709\u6548\u7684\u907f\u514d\u9ed1\u5ba2\u7a83\u53d6\u6216\u8005\u7be1\u6539\u6570\u636e\u4fe1\u606f\uff0c\u540c\u65f6\u4e5f\u80fd\u907f\u514d\u7f51\u7ad9\u5728\u4f20\u8f93\u8fc7\u7a0b\u4e2d\u7684\u4fe1\u606f\u6cc4\u9732\u3002\u5927\u5927\u7684\u63d0\u5347\u6211\u4eec\u7f51\u7ad9\u5b89\u5168\u3002<\/em><\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"712\" height=\"386\" src=\"https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-13.png\" alt=\"\" class=\"wp-image-563\" srcset=\"https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-13.png 712w, https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-13-300x163.png 300w\" sizes=\"(max-width: 712px) 100vw, 712px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc_0\">3.nginx\u7684\u7ec4\u6210\u90e8\u5206<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"619\" height=\"216\" src=\"https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-14.png\" alt=\"\" class=\"wp-image-566\" srcset=\"https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-14.png 619w, https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-14-300x105.png 300w\" sizes=\"(max-width: 619px) 100vw, 619px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>1.\u7b2c\u4e00\u4e2a\u7ec4\u6210\u90e8\u5206Nginx\u4e8c\u8fdb\u5236\u53ef\u6267\u884c\u6587\u4ef6\u2236\u5b83\u662fNginx\u672c\u8eab\u6846\u67b6\u4ee5\u53ca\u76f8\u5173\u6a21\u5757\u7b49\u6784\u5efa\u7684\u4e00\u4e2a\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u5c31\u76f8\u5f53\u4e8e\u6c7d\u8f66\u672c\u8eab\uff0c\u6240\u6709\u7684\u529f\u80fd\u90fd\u7531\u5b83\u63d0\u4f9b\u3002<br>\u2489\u7b2c\u4e8c\u4e2a\u7ec4\u6210\u90e8\u5206Nginx.conf\u6587\u4ef6\u2236\u5b83\u76f8\u5f53\u4e8e\u9a7e\u9a76\u4eba\u5458\uff0c\u867d\u7136\u4e8c\u8fdb\u5236\u53ef\u6267\u884c\u6587\u4ef6\u5df2\u7ecf\u63d0\u4f9b\u4e86\u8bb8\u591a\u7684\u529f\u80fd\uff0c\u4f46\u662f\u8fd9\u4e9b\u529f\u80fd\u7a76\u7adf\u6709\u6ca1\u6709\u5f00\u542f\uff0c\u6216\u8005\u5f00\u542f\u540e\u5b9a\u4e49\u600e\u6837\u7684\u884c\u4e3a\u53bb\u5904\u7406\u8bf7\u6c42\uff0c\u90fd\u662f\u7531nginx.conf\u8fd9\u4e2a\u6587\u4ef6\u51b3\u5b9a\u7684\uff0c\u6240\u4ee5\u4ed6\u5c31\u76f8\u5f53\u4e8e\u8fd9\u4e2a\u6c7d\u8f66\u7684\u9a7e\u9a76\u5458\uff0c\u63a7\u5236\u8fd9\u4e2a\u6c7d\u8f66\u7684\u884c\u4e3a\u3002<br>3.\u7b2c\u4e09\u4e2a\u7ec4\u6210\u90e8\u5206access.log :\u5b83\u76f8\u5f53\u4e8e\u8fd9\u8f86\u6c7d\u8f66\u7ecf\u8fc7\u6240\u6709\u5730\u65b9\u5f62\u6210\u7684GPS\u8f68\u8ff9\uff0caccess.log\u4f1a\u8bb0\u5f55Nginx\u5904\u7406\u8fc7\u7684\u6bcf\u4e00\u6761HTTP\u7684\u8bf7\u6c42\u4fe1\u606f\u3001\u54cd\u5e94\u4fe1\u606f\u3002<br>4.\u7b2c\u56db\u4e2a\u7ec4\u6210\u90e8\u5206error.log :\u5b83\u76f8\u5f53\u4e8e\u9ed1\u5323\u5b50\uff0c\u5f53\u51fa\u73b0\u4e86\u4e00\u4e9b\u4e0d\u53ef\u9884\u671f\u7684\u95ee\u9898\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7error.log\u5c06\u95ee\u9898\u5b9a\u4f4d\u51fa\u6765\u3002<\/p>\n\n\n\n<p><em>Nginx\u7ec4\u6210\u90e8\u5206\u5c0f\u7ed3\ufe30<\/em><\/p>\n\n\n\n<p><em> <\/em>Nginx\u7684\u7ec4\u6210\u90e8\u5206\u662f\u76f8\u8f85\u76f8\u6210\uff0cNginx\u4e8c\u8fdb\u5236\u53ef\u6267\u884c\u6587\u4ef6\u548cNginx.conf\u6587\u4ef6\uff0c\u5b83\u5b9a\u4e49\u4e86Nginx\u5904\u7406\u8bf7\u6c42\u7684\u65b9\u5f0f\u3002<br>\u800c\u5982\u679c\u6211\u4eec\u60f3\u5bf9hnginx\u670d\u52a1\u505a\u4e00\u4e9bweb\u7684\u8fd0\u8425\u548c\u8fd0\u7ef4\uff0c\u9700\u8981\u5bf9access.log\u505a\u8fdb\u4e00\u6b65\u5206\u6790\u3002<br>\u800c\u5982\u679c\u51fa\u73b0\u4e86\u4efb\u4f55\u672a\u77e5\u7684\u9519\u8bef\uff0c\u6216\u8005\u9884\u671f\u7684\u884c\u4e3a\u4e0d\u4e00\u81f4\u65f6\uff0c\u5e94\u8be5\u901a\u8fc7error.log\u53bb\u5b9a\u4f4d\u6839\u672c\u6027\u7684\u95ee\u9898\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc_0\">4.nginx\u5feb\u901f\u5b89\u88c5<\/h2>\n\n\n\n<p>nginx\u7684\u5b89\u88c5\u65b9\u5f0f\u6709\u5f88\u591a\u79cd\u53ef\u4ee5\u4f7f\u7528\u6e90\u7801\u7f16\u8bd1\u5b89\u88c5\uff08\u7248\u672c\u968f\u610f\uff0c\u5b89\u88c5\u590d\u6742\uff0c\u5347\u7ea7\u7e41\u7410\uff09\u3001epel\u4ed3\u5e93\u5b89\u88c5\uff08\u7248\u672c\u8f83\u4f4e\uff0c\u5b89\u88c5\u7b80\u5355\uff0c\u914d\u7f6e\u4e0d\u6613\u8bfb\uff09\u3001\u5b98\u65b9\u4ed3\u5e93\u5b89\u88c5\uff08\u7248\u672c\u8f83\u65b0\uff0c\u5b89\u88c5\u7b80\u5355\uff0c\u914d\u7f6e\u6613\u8bfb\uff09<\/p>\n\n\n\n<p><strong><em>1.\u914d\u7f6e\u5b98\u65b9\u4ed3\u5e93<\/em><\/strong><\/p>\n\n\n\n<p>##\u5b98\u65b9\u4ed3\u5e93\u914d\u7f6e\u5730\u5740http:\/\/nginx.org\/en\/linux_packages.html<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@web01 ~]# cat &gt;&gt; \/etc\/yum.repos.d\/nginx.repo &lt;&lt;EOF\n&#91;nginx-stable]\nname=nginx stable repo\nbaseurl=http:\/\/nginx.org\/packages\/centos\/\\$releasever\/\\$basearch\/\ngpgcheck=1\nenabled=1\ngpgkey=https:\/\/nginx.org\/keys\/nginx_signing.key\nmodule_hotfixes=true\nEOF<\/code><\/pre>\n\n\n\n<p><strong><em>2.\u5b89\u88c5nginx\u670d\u52a1<\/em><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@web01 ~]# yum install nginx -y<\/code><\/pre>\n\n\n\n<p><strong><em>3.\u542f\u52a8nginx\u5e76\u52a0\u5165\u5f00\u673a\u81ea\u542f\u52a8<\/em><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@web01 ~]# systemctl start nginx\n&#91;root@web01 ~]# systemctl enable nginx<\/code><\/pre>\n\n\n\n<p><strong><em>4.\u6d4f\u89c8\u5668\u8bbf\u95ee\u670d\u52a1\u5668\u7684IP\u5730\u5740<\/em><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"241\" src=\"https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-15-1024x241.png\" alt=\"\" class=\"wp-image-569\" srcset=\"https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-15-1024x241.png 1024w, https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-15-300x71.png 300w, https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-15-768x181.png 768w, https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-15-1536x361.png 1536w, https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-15.png 1892w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc_0\">5.nginx\u7684\u76ee\u5f55\u7ed3\u6784<\/h2>\n\n\n\n<p><strong><em>1.\u4ec0\u4e48\u662fnginx<\/em><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@web01 ~]# rpm -ql nginx \n\/etc\/logrotate.d\/nginx           ###\u65e5\u5fd7\u5207\u5272\u6587\u4ef6\n\/etc\/nginx                       ###nginx\u914d\u7f6e\u6587\u4ef6\u76ee\u5f55\n\/etc\/nginx\/conf.d                ###\u5b58\u653e\u7ad9\u70b9\u914d\u7f6e\u6587\u4ef6\u7684\u76ee\u5f55\n\/etc\/nginx\/conf.d\/default.conf   ###\u9ed8\u8ba4\u7684\u7ad9\u70b9\u914d\u7f6e\u6587\u4ef6\n\/etc\/nginx\/fastcgi_params        ###fastcgi\u53c2\u6570\n\/etc\/nginx\/mime.types            ###\u5a92\u4f53\u7c7b\u578b\n\/etc\/nginx\/modules         \n\/etc\/nginx\/nginx.conf            ###nginx\u4e3b\u914d\u7f6e\u6587\u4ef6\n\/etc\/nginx\/scgi_params           ###scgi\u53c2\u6570\n\/etc\/nginx\/uwsgi_params          ###uwsgi\u53c2\u6570\n\/usr\/lib\/systemd\/system\/nginx-debug.service\n\/usr\/lib\/systemd\/system\/nginx.service       ###\u542f\u52a8\u6587\u4ef6\n\/usr\/lib64\/nginx\n\/usr\/lib64\/nginx\/modules                    ###nginx\u6a21\u5757\u5b58\u653e\u8def\u5f84\n\/usr\/libexec\/initscripts\/legacy-actions\/nginx        ###\u5f15\u5bfc\u7684\u811a\u672c\u6587\u4ef6\uff0c\u6ca1\u7528\n\/usr\/libexec\/initscripts\/legacy-actions\/nginx\/check-reload###\u5f15\u5bfc\u7684\u811a\u672c\u6587\u4ef6\uff0c\u6ca1\u7528\n\/usr\/libexec\/initscripts\/legacy-actions\/nginx\/upgrade###\u5f15\u5bfc\u7684\u811a\u672c\u6587\u4ef6\uff0c\u6ca1\u7528\n\/usr\/sbin\/nginx                     ###nginx\u7684\u547d\u4ee4\n\/usr\/sbin\/nginx-debug\n\/usr\/share\/doc\/nginx-1.20.2          ###nginx\u5e2e\u52a9\u6587\u6863\uff0c\u4e0d\u9700\u8981\uff0c\u770b\u5b98\u7f51\u5373\u53ef\n\/usr\/share\/doc\/nginx-1.20.2\/COPYRIGHT###nginx\u5e2e\u52a9\u6587\u6863\uff0c\u4e0d\u9700\u8981\uff0c\u770b\u5b98\u7f51\u5373\u53ef\n\/usr\/share\/man\/man8\/nginx.8.gz       ###nginx\u5e2e\u52a9\u6587\u6863\uff0c\u4e0d\u9700\u8981\uff0c\u770b\u5b98\u7f51\u5373\u53ef\n\/usr\/share\/nginx                   ###nginx\u9ed8\u8ba4\u7684\u9875\u9762\n\/usr\/share\/nginx\/html                ###nginx\u9ed8\u8ba4\u7684\u9875\u9762\n\/usr\/share\/nginx\/html\/50x.html       ###nginx\u9ed8\u8ba4\u7684\u9875\u9762\n\/usr\/share\/nginx\/html\/index.html       ###nginx\u9ed8\u8ba4\u7684\u9875\u9762\n\/var\/cache\/nginx                  ###nginx\u7684\u7f13\u5b58\u76ee\u5f55\n\/var\/log\/nginx<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc_0\">6.nginx\u7684\u914d\u7f6e\u6587\u4ef6<\/h2>\n\n\n\n<p><strong><em>1.\u4e3b\u914d\u7f6e\u6587\u4ef6<\/em><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@web01 ~]# grep -v ^$ \/etc\/nginx\/nginx.conf \nuser  nginx;                           ###\u8fd0\u884c\u7684\u7528\u6237\u540d\u79f0\nworker_processes  auto;                ###Worker\u8fdb\u7a0b\u6570\u91cf\uff08\u7528\u4e8e\u5904\u7406\u7528\u6237\u8bf7\u6c42\uff0c\u6570\u91cf\u4e00\u822c\u4e0eCPU\u6838\u5fc3\u6570\u60f3\u7b49\uff09\nerror_log  \/var\/log\/nginx\/error.log notice;   ###\u9519\u8bef\u65e5\u5fd7\u6587\u4ef6\u8def\u5f84\uff0c\u6700\u5c0f\u7ea7\u522b\u4e3anotice\npid        \/var\/run\/nginx.pid;                  ###Pid\u6587\u4ef6\u8def\u5f84\nevents {                                        ###\u4e8b\u4ef6\u6a21\u5757\n    worker_connections  1024;                    ###\u6bcf\u4e2a\u8fdb\u7a0b\u7684\u8fde\u63a5\u6570\uff08\u5e76\u53d1\uff09\n}\nhttp {                                          ### http\u6a21\u5757\n    include       \/etc\/nginx\/mime.types;        ###\u5a92\u4f53\u7c7b\u578b\uff08\u6587\u4ef6\u7c7b\u578b\uff09\uff0cinclude\u5f15\u7528\u6216\u5305\u542b\u5176\u4ed6\u4f4d\u7f6e\u7684\u914d\u7f6e\uff0c\u7cbe\u7b80\u4e3b\u914d\u7f6e\u6587\u4ef6\n    default_type  application\/octet-stream;     ###\u9ed8\u8ba4\u8bbf\u95ee\u7c7b\u578b\uff08\u4e0b\u8f7d\uff09\n    log_format  main  '$remote_addr - $remote_user &#91;$time_local] \"$request\" ' ###\u65e5\u5fd7\u683c\u5f0f\n                      '$status $body_bytes_sent \"$http_referer\" '\n                      '\"$http_user_agent\" \"$http_x_forwarded_for\"';\n    access_log  \/var\/log\/nginx\/access.log  main;                            ###\u8bbf\u95ee\u65e5\u5fd7\u6587\u4ef6\u8def\u5f84\n    sendfile        on;                             ###\u5f00\u542f\u9ad8\u6548\u4f20\u8f93\n    #tcp_nopush     on;                                ###\n    keepalive_timeout  65;                           ###\u957f\u94fe\u63a5\u8d85\u65f6\u65f6\u95f4\n    #gzip  on;                         ###\u662f\u5426\u5f00\u542fgzip\u538b\u7f29\uff08\u9759\u6001\u8d44\u6e90\uff09\uff0c\u89c6\u9891\u8f6c\u7801\u4e0e\u6b64\u65e0\u5173\n    include \/etc\/nginx\/conf.d\/*.conf;  ###\u5f15\u7528\u7684\u914d\u7f6e\u6587\u4ef6\u8def\u5f84\n}<\/code><\/pre>\n\n\n\n<p><strong><em>2.http\u5c42\u5b50\u914d\u7f6e\u6587\u4ef6<\/em><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@web01 ~]# grep -v ^$ \/etc\/nginx\/conf.d\/default.conf \nserver {                             ###server\u5c42\n    listen       80;                 ###\u76d1\u542c\u7684\u7aef\u53e3\n    server_name  localhost;          ###\u76d1\u542c\u7684\u670d\u52a1\u540d\u79f0\uff08\u57df\u540d\uff09\n    #access_log  \/var\/log\/nginx\/host.access.log  main;  ###\u8bbf\u95ee\u65e5\u5fd7\u8def\u5f84\n    location \/ {                                        ###location\u5c42\n        root   \/usr\/share\/nginx\/html;                   ###\u7ad9\u70b9\u76ee\u5f55\n        index  index.html index.htm;                    ###\u9996\u9875\u6587\u4ef6\n    }\n    #error_page  404              \/404.html;             ###404\u9519\u8bef\u8fd4\u56de\u7684\u9875\u9762\n    # redirect server error pages to the static page \/50x.html\n    #\n    error_page   500 502 503 504  \/50x.html;             ###500 502 503 504\u8fd4\u56de\u7684\u9875\u9762\n    location = \/50x.html {\n        root   \/usr\/share\/nginx\/html;\n    }\n    # proxy the PHP scripts to Apache listening on 127.0.0.1:80\n    #\n    #location ~ \\.php$ {                             ###nginx\u4ee3\u7406\n    #    proxy_pass   http:\/\/127.0.0.1;               ###\u4ee3\u7406\u7684\u540e\u7aef\u5730\u5740\n    #}\n    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000\n    #\n    #location ~ \\.php$ {                             ###nginx\u4ee3\u7406php\u7684\u914d\u7f6e\u6587\u4ef6\n    #    root           html;\n    #    fastcgi_pass   127.0.0.1:9000;\n    #    fastcgi_index  index.php;\n    #    fastcgi_param  SCRIPT_FILENAME  \/scripts$fastcgi_script_name;\n    #    include        fastcgi_params;\n    #}\n    # deny access to .htaccess files, if Apache's document root\n    # concurs with nginx's one\n    #\n    #location ~ \/\\.ht {    ###\u4ee5ht\u7ed3\u5c3e\u7684\u5168\u90e8\u62d2\u7edd\u8bbf\u95ee\n    #    deny  all;\n    #}\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc_0\">7.\u81ea\u5b9a\u4e49\u4e00\u4e2anginx\u7684web\u7ad9\u70b9<\/h2>\n\n\n\n<p><strong><em>1.\u7f16\u5199nginx\u914d\u7f6e\u6587\u4ef6\uff0c\u5b9a\u4e49\u7aef\u53e3\uff0c\u5b9a\u4e49\u57df\u540d\uff0c\u5b9a\u4e49\u8fd4\u56de\u7684\u8def\u5f84\uff0c\u4ee5\u53ca\u9ed8\u8ba4\u9875\u9762<\/em><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@web01 ~]# cat \/etc\/nginx\/conf.d\/diy.sunfuyang.com.conf\nserver {\n\tlisten 80;\n\tserver_name diy.sunfuyang.com;\n\tlocation \/ {\n\t\troot \/code\/diy;\n\t\tindex index.html;\n\t}\n\n}<\/code><\/pre>\n\n\n\n<p><strong><em>2.\u521b\u5efa\u5bf9\u5e94\u7f51\u7ad9\u7684\u7ad9\u70b9\u76ee\u5f55\uff0c\u5e76\u5b58\u653e\u5bf9\u5e94\u7684\u4ee3\u7801<\/em><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@web01 ~]# mkdir \/code\/diy -p\n&#91;root@web01 ~]# echo sunfuyang &gt; \/code\/diy\/index.html<\/code><\/pre>\n\n\n\n<p><strong><em>3.\u68c0\u67e5\u8bed\u6cd5\uff0c\u5e76\u91cd\u65b0\u52a0\u8f7d\u670d\u52a1<\/em><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@web01 ~]# nginx -t\nnginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful\n&#91;root@web01 ~]# systemctl reload nginx.service<\/code><\/pre>\n\n\n\n<p><strong><em>4.\u914d\u7f6ehost\u52ab\u6301\uff0c\u901a\u8fc7\u57df\u540d\u8bbf\u95ee\u7f51\u7ad9<\/em><\/strong><\/p>\n\n\n\n<p>windows\u7684hosts\u6587\u4ef6\u8def\u5f84C:\\Windows\\System32\\drivers\\etc\\hosts<br>linux\u7684hosts\u6587\u4ef6\u8def\u5f84\/etc\/hosts<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"408\" src=\"https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-16-1024x408.png\" alt=\"\" class=\"wp-image-571\" srcset=\"https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-16-1024x408.png 1024w, https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-16-300x119.png 300w, https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-16-768x306.png 768w, https:\/\/www.buyao007.icu\/wp-content\/uploads\/2022\/02\/image-16.png 1047w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc_0\">8.nginx\u5904\u7406\u8bf7\u6c42\u6d41\u7a0b<\/h2>\n\n\n\n<p>1.\u7528\u6237\u8f93\u5165url\u57df\u540d<br>2.DNS\u89e3\u6790:\u67e5\u627e\u57df\u540d\u5bf9\u5e94\u7684ip\u5730\u5740(\u83b7\u5f97\u57df\u540d\u5bf9\u5e94\u7684ip\u5730\u5740)<br>3.tcp3\u6b21\u63e1\u624b:\u7528\u6237\u901a\u8fc7ip\u5730\u5740\u4e0e\u5bf9\u5e94\u7684\u670d\u52a1\u5668\u5efa\u7acb\u8fde\u63a5(\u4e0e\u670d\u52a1\u5668\u8fde\u63a5)<br>4.http\u8bf7\u6c42\u62a5\u6587:\u5efa\u7acbtcp\u8fde\u63a5\u540e,\u7528\u6237\u5411\u670d\u52a1\u5668\u7d22\u8981\u6307\u5b9a\u7684\u5185\u5bb9(\u9875\u9762, \u56fe\u7247,\u89c6\u9891\u2026.) (\u5411\u670d\u52a1\u7d22\u8981\u5185\u5bb9)<br>5.\u670d\u52a1\u5668\u901a\u8fc7\u67e5\u627e (nginx\u5982\u4f55\u5904\u7406\u8bf7\u6c42)<br>6.http\u54cd\u5e94\u62a5\u6587: \u627e\u5230\u540e\u628a\u7528\u6237\u8981\u7684\u5185\u5bb9,\u8fd4\u8fd8\u7ed9\u7528\u6237(\u670d\u52a1\u578b\u54cd\u5e94\u7528\u6237)<br>7.tcp4\u6b21\u6325\u624b:\u7528\u6237\u4e0e\u670d\u52a1\u5668\u65ad\u5f00\u8fde\u63a5<\/p>\n\n\n\n<p>ps\uff1anginx\u4e2d\u7684http\u3001server\u3001location\u4e4b\u95f4\u7684\u5173\u7cfb\u662f\uff1f<br>http \u6807\u7b7e\u4e3b\u8981\u7528\u6765\u89e3\u51b3\u7528\u6237\u7684\u8bf7\u6c42\u4e0e\u54cd\u5e94\u3002<br>server \u6807\u7b7e\u4e3b\u8981\u7528\u6765\u54cd\u5e94\u5177\u4f53\u7684\u67d0\u4e00\u4e2a\u7f51\u7ad9\u3002<br>location \u6807\u7b7e\u4e3b\u8981\u7528\u4e8e\u5339\u914d\u7f51\u7ad9\u5177\u4f53URL\u8def\u5f84\u3002<br>http{}\u5c42\u4e0b\u5141\u8bb8\u6709\u591a\u4e2aServer{}\uff0c\u4e00\u4e2aServer{}\u4e0b\u53c8\u6709\u591a\u4e2alocation{}<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc_0\">9.nginx\u7684\u865a\u62df\u4e3b\u673a<\/h2>\n\n\n\n<p>\u6240\u8c13\u865a\u62df\u4e3b\u673a\uff0c\u5728web\u670d\u52a1\u5668\u91cc\u662f\u4e00\u4e2a\u72ec\u7acb\u7684\u7f51\u7ad9\u7ad9\u70b9\uff0c\u8fd9\u4e2a\u7ad9\u70b9\u5bf9\u5e94\u72ec\u7acb\u7684\u57df\u540d(\u4e5f\u53ef\u80fd\u662fIP\u6216\u7aef\u53e3)\uff0c\u5177\u6709\u72ec\u7acb\u7684\u7a0b\u5e8f\u53ca\u8d44\u6e90\u76ee\u5f55\uff0c\u53ef\u4ee5\u72ec\u7acb\u5730\u5bf9\u5916\u63d0\u4f9b\u670d\u52a1\u4f9b\u7528\u6237\u8bbf\u95ee\u3002<\/p>\n\n\n\n<p><strong><em>1.\u57fa\u4e8eIP\u7684\u865a\u62df\u4e3b\u673a\uff08\u4e0d\u5e38\u7528\uff09<\/em><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@web01 ~]# cat \/etc\/nginx\/conf.d\/ip1.conf \r\nserver {\r\n\tlisten 10.0.0.7:80;###\u76d1\u542c\u5728\u8fd9\u4e2aip\u768480\u7aef\u53e3\r\n\tlocation \/ {\r\n\t\troot \/code\/ip1;\r\n\t\tindex index.html;\r\n\t}\r\n}\r\n<\/code><\/pre>\n\n\n\n<p><strong><em>2.\u57fa\u4e8e\u591a\u7aef\u53e3\u7684\u865a\u62df\u4e3b\u673a<\/em><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@web01 ~]# cat \/etc\/nginx\/conf.d\/duankou1.conf \nserver {\n\tlisten 80;##\u76d1\u542c\u5728\u6240\u6709ip\u768480\u7aef\u53e3\n\tlocation \/ {\n\t\troot \/code\/ip1;\n\t\tindex index.html;\n\t}\n}<\/code><\/pre>\n\n\n\n<p><strong><em>3.\u57fa\u4e8e\u591a\u57df\u540d\u7684\u865a\u62df\u4e3b\u673a<\/em><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@web01 ~]# cat \/etc\/nginx\/conf.d\/{www,bbs}.conf\nserver {\n    listen       80;\n    server_name  www.sfy.com;\n    root \/soft\/code\/www;\n    ...\n}\n \nserver {\n    ...\n    listen       80;\n    server_name  bbs.sfy.com;\n    root \/soft\/code\/bbs;\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b59\u5bcc\u9633\uff0c \u6c5f\u6e56\u4eba\u79f0\u6ca1\u4eba\u79f0\u3002\u591a\u5e74\u4e92\u8054\u7f51\u8fd0\u7ef4\u5de5\u4f5c\u7ecf\u9a8c\uff0c\u66fe\u8d1f\u8d23\u8fc7\u5b59\u5e03\u65af\u5927\u89c4\u6a21\u96c6\u7fa4\u67b6\u6784\u81ea\u52a8\u5316\u8fd0\u7ef4\u7ba1\u7406\u5de5\u4f5c\u3002\u64c5\u957fWeb\u96c6 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":246,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.buyao007.icu\/index.php?rest_route=\/wp\/v2\/posts\/545"}],"collection":[{"href":"https:\/\/www.buyao007.icu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.buyao007.icu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.buyao007.icu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.buyao007.icu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=545"}],"version-history":[{"count":6,"href":"https:\/\/www.buyao007.icu\/index.php?rest_route=\/wp\/v2\/posts\/545\/revisions"}],"predecessor-version":[{"id":577,"href":"https:\/\/www.buyao007.icu\/index.php?rest_route=\/wp\/v2\/posts\/545\/revisions\/577"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.buyao007.icu\/index.php?rest_route=\/wp\/v2\/media\/246"}],"wp:attachment":[{"href":"https:\/\/www.buyao007.icu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.buyao007.icu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=545"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.buyao007.icu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}