{"id":1536,"date":"2023-09-06T15:38:22","date_gmt":"2023-09-06T07:38:22","guid":{"rendered":"https:\/\/white-night.club\/?p=1536"},"modified":"2023-11-09T11:07:53","modified_gmt":"2023-11-09T03:07:53","slug":"web1","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/09\/06\/web1\/","title":{"rendered":"configure\u4e0eNginx"},"content":{"rendered":"\n<p>nginx\u65e2\u53ef\u4ee5\u901a\u8fc7\u4e00\u7cfb\u5217\u7684configure\uff08\u4ee5\u4e0b\u7b80\u79f0\u914d\u7f6e\u6587\u4ef6\uff09\u8fdb\u884c\u9759\u6001\u914d\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7TCP\/HTTP\u5728\u8fd0\u884c\u65f6\u52a8\u6001\u53d8\u5316\u914d\u7f6e\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>\u914d\u7f6e\u6587\u4ef6<\/p>\n<cite><em>\u5148\u6765\u770b\u770b\u4ec0\u4e48\u662f\u914d\u7f6e\u6587\u4ef6<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u914d\u7f6e\u6587\u4ef6\u76f8\u5f53\u4e8e\u662fnginx\u7684\u6838\u5fc3\u3002\u914d\u7f6e\u6587\u4ef6\u542c\u8d77\u6765\u5f88\u96be\u61c2\uff0c\u5b9e\u9645\u4e0a\u5b83\u4e5f\u662f\u4e00\u4e2a\u666e\u901a\u7684\u7eaf\u6587\u672c\u6587\u4ef6\u3002\u4e0d\u8fc7nginx\u7684\u914d\u7f6e\u6587\u4ef6\u7684\u8bed\u6cd5<mark style=\"background-color:rgba(0, 0, 0, 0);color:#fcb900\" class=\"has-inline-color\">\u6df7\u5408\u4e86Shell\uff0cPerl\u548cC\u8bed\u8a00\u7684\u90e8\u5206\u7279\u6027<\/mark>\u3002\u6bd4\u5982\u65e2\u53ef\u4ee5include\u5176\u4ed6\u7684\u914d\u7f6e\u6587\u4ef6\uff08C\u8bed\u8a00\uff09\uff0c\u4e5f\u53ef\u4ee5\u7528$var\u5f15\u7528\u9884\u5b9a\u4e49\u7684\u53d8\u91cf\uff08Shell\uff09\u3002<\/p>\n\n\n\n<p>\u6bd4\u5982nginx\u81ea\u5e26\u7684\u914d\u7f6e\u6587\u4ef6\u3002\u5982\u679c\u4f60\u548c\u6211\u4e00\u6837\u7528\u7684\u662fUbuntu\uff0c\u90a3\u4e48\u4f60\u53ef\u4ee5\u5728\/usr\/local\/nginx\/conf\u4e2d\u627e\u5230nginx\u7684\u9ed8\u8ba4\u914d\u7f6e\u6587\u4ef6\u3002\u8fd9\u91cc\u7528nginx.conf\u4e3e\u4f8b\uff08\u53ea\u662f\u4e3a\u4e86\u8fc7\u4e00\u904d\uff0c\u6240\u4ee5\u5220\u6389\u4e86\u5927\u90e8\u5206\u5185\u5bb9\uff0c\u5efa\u8bae\u81ea\u5df1\u7ffb\u914d\u7f6e\u6587\u4ef6\u7422\u78e8\u7422\u78e8\uff09\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#user  nobody;  <mark style=\"background-color:rgba(0, 0, 0, 0);color:#00ff2f\" class=\"has-inline-color\">#\u524d\u9762\u5e26\u2018#\u2019\u7684\u5c31\u662f\u6ce8\u91ca<\/mark>\nworker_processes  1; \n\nevents {\n    worker_connections  1024;\n}\n\nhttp {\n    ...\n}<\/code><\/pre>\n\n\n\n<p>\u4e00\u4e2a\u4e00\u4e2a\u89e3\u91ca\u3002<\/p>\n\n\n\n<ul>\n<li><em>worker_processes 1<\/em>\uff1a\u8fdb\u7a0b\u914d\u7f6e\u4e4b\u4e00\u3002\u53ea\u80fd\u5728\u5168\u5c40\u57df\u4e2d\u914d\u7f6e\u3002\u8be5\u6307\u4ee4\u4f5c\u7528\u4e3a<mark style=\"background-color:rgba(0, 0, 0, 0);color:#fcb900\" class=\"has-inline-color\">\u8bbe\u7f6enginx\u80fd\u591f\u542f\u52a8\u7684worker\u8fdb\u7a0b\u7684\u6570\u91cf\uff0c\u4f1a\u76f4\u63a5\u5f71\u54cd\u5230nginx\u7684\u6027\u80fd<\/mark>\u3002<\/li>\n\n\n\n<li><em>events<\/em>\uff1aevents\uff08\u4e8b\u4ef6\uff09\u914d\u7f6e\u5757\u3002nginx\u7531\u4e8b\u4ef6\u9a71\u52a8\uff0c\u4e00\u822c\u6765\u8bf4\u9ed8\u8ba4\u8bbe\u7f6e\u5c31\u591f\u7528\u4e86\u3002\n<ul>\n<li>worker_connections 1024\uff1a\u914d\u7f6e<mark style=\"background-color:rgba(0, 0, 0, 0);color:#fcb900\" class=\"has-inline-color\">\u5355\u4e2a<\/mark>worker\u7684\u6700\u5927\u8fde\u63a5\u6570\u3002\u51b3\u5b9a\u4e86nginx\u7684\u5e76\u53d1\u80fd\u529b\u3002\u5982\u679c\u67092\u4e2aworker\uff0c\u90a3\u7406\u8bba\u4e0a\u53ef\u4ee5\u652f\u63011024*2\u4e2a\u5e76\u53d1\u8fde\u63a5\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><em>http<\/em>\uff1a\u914d\u7f6ehttp\u670d\u52a1\u3002nginx\u4f1a\u7528http\u5757\u914d\u7f6eHTTP\u76f8\u5173\u7684\u6240\u6709\u529f\u80fd\u3002\u8fd9\u5757\u5185\u5bb9\u5f88\u591a\u4e00\u65f6\u8bb2\u4e0d\u5b8c\uff0c\u540c\u65f6\u5b83\u4e5f\u662fnginx\u4e2d\u7684\u91cd\u70b9\u3002\u8be5\u5757\u4e2d\u8fd8\u6709server,location\u7b49\u7684\u914d\u7f6e\u6307\u4ee4\uff0c\u5982\u679c\u81ea\u5df1\u7ffb\u4e00\u4e0b\u5c31\u4f1a\u53d1\u73b0http\u914d\u7f6e\u5757\u7684\u5185\u5bb9\uff0c\u5360\u6574\u4e2a\u914d\u7f6e\u6587\u4ef6\u768480%-85%\u3002<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b80\u8ff0configure\uff08\u914d\u7f6e\u6587\u4ef6\uff09\u4e0enginx\u7684\u5173\u7cfb\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"base","format":"standard","meta":{"footnotes":""},"categories":[66,65],"tags":[68,67],"_links":{"self":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/1536"}],"collection":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/comments?post=1536"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/1536\/revisions"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=1536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=1536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=1536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}