{"id":206,"date":"2014-08-28T10:35:46","date_gmt":"2014-08-28T02:35:46","guid":{"rendered":"http:\/\/www.codeeel.com\/?p=206"},"modified":"2014-08-28T10:35:46","modified_gmt":"2014-08-28T02:35:46","slug":"nginx-http%e7%9a%84%e6%a0%b8%e5%bf%83%e6%a8%a1%e5%9d%97","status":"publish","type":"post","link":"https:\/\/www.codeeel.com\/?p=206","title":{"rendered":"Nginx HTTP\u7684\u6838\u5fc3\u6a21\u5757"},"content":{"rendered":"<div>\n<h3>aio<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aaio [on|off|sendfile]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aoff<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u8fd9\u4e2a\u6307\u4ee4\u5728Linux\u5185\u68382.6.1922\u4ee5\u4e0a\u7248\u672c\u53ef\u4ee5\u4f7f\u7528\uff0c\u5bf9\u4e8eLinux\u5185\u6838\uff0c\u8fd9\u4e2a\u6307\u4ee4\u9700\u8981\u914d\u5408directio\u6307\u4ee4\uff0c\u4f7f\u7528\u8fd9\u4e2a\u6307\u4ee4\u5c06\u81ea\u52a8\u5173\u95edsendfile\u652f\u6301\u3002location \/video {<br \/>\naio on;<br \/>\ndirectio 512;<br \/>\noutput_buffers 1 128k;<br \/>\n}\u5728FreeBSD5.2.1\u4e4b\u524d\u7248\u672c\u548cNginx0.8.12,\u4f60\u5fc5\u987b\u624b\u5de5\u5173\u95edsendfile\uff1alocation \/video {<br \/>\naio on;<br \/>\nsendfile off;<br \/>\noutput_buffers 1 128k;<br \/>\n}\u540c\u6837\u4e5f\u53ef\u4ee5\u548csendfile\u4e00\u8d77\u4f7f\u7528\uff08FreeBSD5.2.1\u548cNginx0.8.12\uff09\uff1alocation \/video {<br \/>\naio sendfile;<br \/>\nsendfile on;<br \/>\ntcp_nopush on;<br \/>\n}<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-alias\"><\/a>alias<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aalias file-path|directory-path;<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1ano<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1alocation<br \/>\n\u8fd9\u4e2a\u6307\u4ee4\u4e3a\u4e00\u4e2alocation\u6307\u5b9a\u4e00\u4e2a\u8def\u5f84\uff0c\u6ce8\u610f\u5b83\u53ef\u80fd\u7c7b\u4f3c\u4e8eroot\uff0c\u4f46\u662fdocument root\u6ca1\u6709\u6539\u53d8\uff0c\u8bf7\u6c42\u53ea\u662f\u4f7f\u7528\u4e86\u522b\u540d\u76ee\u5f55\u7684\u6587\u4ef6\u3002\u8fd9\u4e2alocation\u81ea\u8eab\u4e3a\u201c\u4e22\u5f03\u7684\u201d\uff0c\u5177\u4f53\u8bf7\u770b\u4e0b\u9762\u7684\u4f8b\u5b50\uff1alocation \/i\/ {<br \/>\nalias \/spool\/w3\/images\/;<br \/>\n}<br \/>\n\u4e0a\u4e2a\u4f8b\u5b50\u603b\uff0c\u8bf7\u6c42\u201d\/i\/top.gif\u201d\u5c06\u8fd4\u56de\u8fd9\u4e2a\u6587\u4ef6: \u201d\/spool\/w3\/images\/top.gif\u201d\u3002\u6b63\u5982\u4f60\u6240\u770b\u5230\u7684\uff0curi\u4e2dlocation\u540e\u9762\u7684\u90e8\u5206\u4f1a\u8ffd\u52a0\u5230\u8fd9\u4e2a\u76ee\u5f55\u540e\u9762\uff0c\u800clocation\u81ea\u8eab\u662f\u201c\u4e22\u5f03\u7684\u201d\uff0c\u5982\u679c\u4f7f\u7528<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:httpcore#root\" rel=\"nofollow\">root<\/a>\u6307\u4ee4\u7684\u8bdd\u4f1a\u8fdb\u884c\u5b8c\u6574\u7684\u8ffd\u52a0\uff0c\u5982\u4e0a\u4f8b\u4e2d\uff0c\u5982\u679c\u4f7f\u7528root\u6307\u4ee4\u5219\u8fd4\u56de\uff1a\u201d\/spool\/w3\/images\/i\/top.gif\u201d<br \/>\nAlias\u540c\u6837\u53ef\u4ee5\u7528\u4e8e\u5e26\u6b63\u5219\u8868\u8fbe\u5f0f\u7684location\uff0c\u5982\uff1alocation ~ ^\/download\/(.*)$ {<br \/>\nalias \/home\/website\/files\/$1;<br \/>\n}\u8bf7\u6c42\u201d\/download\/book.pdf\u201d\u5c06\u8fd4\u56de\u201d\/home\/website\/files\/book.pdf\u201d\u3002\u540c\u6837\u6ce8\u610f\uff0curi\u4e2dlocation\u540e\u9762\u7684\u90e8\u5206\u4f1a\u8ffd\u52a0\u5230\u8fd9\u4e2a\u76ee\u5f55\u540e\u9762\u3002<br \/>\n\u540c\u6837\uff0c\u4e5f\u53ef\u4ee5\u5728\u522b\u540d\u76ee\u5f55\u5b57\u6bb5\u4e2d\u4f7f\u7528\u53d8\u91cf\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-chunkedtransferencoding\"><\/a>chunked_transfer_encoding<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1achunked_transfer_encoding on|off;<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aon<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u6307\u5b9a\u662f\u5426\u5728\u54cd\u5e94\u65f6\u542f\u7528chunked\u7f16\u7801\uff08\u53ea\u80fd\u4f7f\u7528\u4e8eHTTP1.1\u7248\u672c\u4ee5\u4e0a\u7684\u8fde\u63a5\uff09\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-clientbodyinfileonly\"><\/a>client_body_in_file_only<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aclient_body_in_file_only on|off<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aoff<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u8fd9\u4e2a\u6307\u4ee4\u59cb\u7ec8\u5b58\u50a8\u4e00\u4e2a\u8fde\u63a5\u8bf7\u6c42\u5b9e\u4f53\u5230\u4e00\u4e2a\u6587\u4ef6\u5373\u4f7f\u5b83\u53ea\u67090\u5b57\u8282\u3002<br \/>\n\u6ce8\u610f\uff1a\u5982\u679c\u8fd9\u4e2a\u6307\u4ee4\u6253\u5f00\uff0c\u90a3\u4e48\u4e00\u4e2a\u8fde\u63a5\u8bf7\u6c42\u5b8c\u6210\u540e\uff0c\u6240\u5b58\u50a8\u7684\u6587\u4ef6\u5e76\u4e0d\u4f1a\u5220\u9664\u3002<br \/>\n\u8fd9\u4e2a\u6307\u4ee4\u53ef\u4ee5\u7528\u4e8edebug\u8c03\u8bd5\u548c<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:optionalhttpmodules:embeddedperl\" rel=\"nofollow\">\u5d4c\u5165\u5f0fPerl\u6a21\u5757<\/a>\u4e2d\u7684$r\u2192request_body_file\u65b9\u6cd5\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-clientbodyinsinglebuffer\"><\/a>client_body_in_single_buffer<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aclient_body_in_single_buffer<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aoff<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u8fd9\u4e2a\u6307\u4ee4(0.7.58\u7248\u672c)\u6307\u5b9a\u662f\u5426\u5c06\u5ba2\u6237\u7aef\u8fde\u63a5\u8bf7\u6c42\u5b8c\u6574\u7684\u653e\u5165\u4e00\u4e2a\u7f13\u51b2\u533a\uff0c\u5f53\u4f7f\u7528\u53d8\u91cf$request_body\u65f6\u63a8\u8350\u4f7f\u7528\u8fd9\u4e2a\u6307\u4ee4\u4ee5\u51cf\u5c11\u590d\u5236\u64cd\u4f5c\u3002<br \/>\n\u5982\u679c\u65e0\u6cd5\u5c06\u4e00\u4e2a\u8bf7\u6c42\u653e\u5165\u5355\u4e2a\u7f13\u51b2\u533a\uff0c\u5c06\u4f1a\u88ab\u653e\u5165\u78c1\u76d8\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-clientbodybuffersize\"><\/a>client_body_buffer_size<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aclient_body_buffer_size the_size<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1a8k\/16k<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u8fd9\u4e2a\u6307\u4ee4\u53ef\u4ee5\u6307\u5b9a\u8fde\u63a5\u8bf7\u6c42\u5b9e\u4f53\u7684\u7f13\u51b2\u533a\u5927\u5c0f\u3002<br \/>\n\u5982\u679c\u8fde\u63a5\u8bf7\u6c42\u8d85\u8fc7\u7f13\u5b58\u533a\u6307\u5b9a\u7684\u503c\uff0c\u90a3\u4e48\u8fd9\u4e9b\u8bf7\u6c42\u5b9e\u4f53\u7684\u6574\u4f53\u6216\u90e8\u5206\u5c06\u5c1d\u8bd5\u5199\u5165\u4e00\u4e2a\u4e34\u65f6\u6587\u4ef6\u3002<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\u4e3a\u4e24\u4e2a\u5185\u5b58\u5206\u9875\u5927\u5c0f\u503c\uff0c\u6839\u636e\u5e73\u53f0\u7684\u4e0d\u540c\uff0c\u53ef\u80fd\u662f8k\u621616k\u3002<br \/>\n\u5f53\u8bf7\u6c42\u5934\u4e2d\u7684Content-Length\u5b57\u6bb5\u5c0f\u4e8e\u6307\u5b9a\u7684buffer size\uff0c\u90a3\u4e48Nginx\u5c06\u4f7f\u7528\u8f83\u5c0f\u7684\u4e00\u4e2a\uff0c\u6240\u4ee5nginx\u5e76\u4e0d\u603b\u662f\u4e3a\u6bcf\u4e00\u4e2a\u8bf7\u6c42\u5206\u914d\u8fd9\u4e2abuffer size\u5927\u5c0f\u7684buffer\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-clientbodytemppath\"><\/a>client_body_temp_path<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aclient_body_temp_path dir-path [ level1 [ level2 [ level3 ]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aclient_body_temp<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u6307\u4ee4\u6307\u5b9a\u8fde\u63a5\u8bf7\u6c42\u5b9e\u4f53\u8bd5\u56fe\u5199\u5165\u7684\u4e34\u65f6\u6587\u4ef6\u8def\u5f84\u3002<br \/>\n\u53ef\u4ee5\u6307\u5b9a\u4e09\u7ea7\u76ee\u5f55\u7ed3\u6784\uff0c\u5982\uff1aclient_body_temp_path \/spool\/nginx\/client_temp 1 2;\u90a3\u4e48\u5b83\u7684\u76ee\u5f55\u7ed3\u6784\u53ef\u80fd\u662f\u8fd9\u6837\uff1a\/spool\/nginx\/client_temp\/7\/45\/00000123457<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-clientbodytimeout\"><\/a>client_body_timeout<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aclient_body_timeout time<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1a60<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u6307\u4ee4\u6307\u5b9a\u8bfb\u53d6\u8bf7\u6c42\u5b9e\u4f53\u7684\u8d85\u65f6\u65f6\u95f4\u3002<br \/>\n\u8fd9\u91cc\u7684\u8d85\u65f6\u662f\u6307\u4e00\u4e2a\u8bf7\u6c42\u5b9e\u4f53\u6ca1\u6709\u8fdb\u5165\u8bfb\u53d6\u6b65\u9aa4\uff0c\u5982\u679c\u8fde\u63a5\u8d85\u8fc7\u8fd9\u4e2a\u65f6\u95f4\u800c\u5ba2\u6237\u7aef\u6ca1\u6709\u4efb\u4f55\u54cd\u5e94\uff0cNginx\u5c06\u8fd4\u56de\u4e00\u4e2a\u201dRequest time out\u201d (408)\u9519\u8bef<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-clientheaderbuffersize\"><\/a>client_header_buffer_size<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aclient_header_buffer_size size<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1a1k<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server<br \/>\n\u6307\u4ee4\u6307\u5b9a\u5ba2\u6237\u7aef\u8bf7\u6c42\u5934\u90e8\u7684\u7f13\u51b2\u533a\u5927\u5c0f<br \/>\n\u7edd\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u4e00\u4e2a\u8bf7\u6c42\u5934\u4e0d\u4f1a\u5927\u4e8e1k<br \/>\n\u4e0d\u8fc7\u5982\u679c\u6709\u6765\u81ea\u4e8ewap\u5ba2\u6237\u7aef\u7684\u8f83\u5927\u7684cookie\u5b83\u53ef\u80fd\u4f1a\u5927\u4e8e1k\uff0cNginx\u5c06\u5206\u914d\u7ed9\u5b83\u4e00\u4e2a\u66f4\u5927\u7684\u7f13\u51b2\u533a\uff0c\u8fd9\u4e2a\u503c\u53ef\u4ee5\u5728large_client_header_buffers\u91cc\u9762\u8bbe\u7f6e\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-clientheadertimeout\"><\/a>client_header_timeout<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aclient_header_timeout time<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1a60<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server<br \/>\n\u6307\u4ee4\u6307\u5b9a\u8bfb\u53d6\u5ba2\u6237\u7aef\u8bf7\u6c42\u5934\u6807\u9898\u7684\u8d85\u65f6\u65f6\u95f4\u3002<br \/>\n\u8fd9\u91cc\u7684\u8d85\u65f6\u662f\u6307\u4e00\u4e2a\u8bf7\u6c42\u5934\u6ca1\u6709\u8fdb\u5165\u8bfb\u53d6\u6b65\u9aa4\uff0c\u5982\u679c\u8fde\u63a5\u8d85\u8fc7\u8fd9\u4e2a\u65f6\u95f4\u800c\u5ba2\u6237\u7aef\u6ca1\u6709\u4efb\u4f55\u54cd\u5e94\uff0cNginx\u5c06\u8fd4\u56de\u4e00\u4e2a\u201dRequest time out\u201d (408)\u9519\u8bef\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-clientmaxbodysize\"><\/a>client_max_body_size<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aclient_max_body_size size<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aclient_max_body_size 1m<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u6307\u4ee4\u6307\u5b9a\u5141\u8bb8\u5ba2\u6237\u7aef\u8fde\u63a5\u7684\u6700\u5927\u8bf7\u6c42\u5b9e\u4f53\u5927\u5c0f\uff0c\u5b83\u51fa\u73b0\u5728\u8bf7\u6c42\u5934\u90e8\u7684Content-Length\u5b57\u6bb5\u3002<br \/>\n\u5982\u679c\u8bf7\u6c42\u5927\u4e8e\u6307\u5b9a\u7684\u503c\uff0c\u5ba2\u6237\u7aef\u5c06\u6536\u5230\u4e00\u4e2a\u201dRequest Entity Too Large\u201d (413)\u9519\u8bef\u3002<br \/>\n\u8bb0\u4f4f\uff0c\u6d4f\u89c8\u5668\u5e76\u4e0d\u77e5\u9053\u600e\u6837\u663e\u793a\u8fd9\u4e2a\u9519\u8bef\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-connectionpoolsize\"><\/a>connection_pool_size<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aconnection_pool_size the_size<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aconnection_pool_size the_size 256<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp (\u6216\u8bb8\u53ef\u4ee5\u7528\u5230\u5176\u4ed6\u5730\u65b9?)<br \/>\n\u4e3a\u6bcf\u4e2a\u8bf7\u6c42\u5206\u914d\u7684\u5185\u5b58\u6c60\uff0c\u5185\u5b58\u6c60\u7528\u4e8e\u5c0f\u914d\u989d\u5185\u5b58\u5757\uff0c\u5982\u679c\u4e00\u4e2a\u5757\u5927\u4e8e\u5185\u5b58\u6c60\u6216\u8005\u5927\u4e8e\u5206\u9875\u5927\u5c0f\uff0c\u90a3\u4e48\u5b83\u5c06\u88ab\u5206\u914d\u5230\u5185\u5b58\u6c60\u4e4b\u5916\uff0c\u5982\u679c\u4f4d\u4e8e\u5185\u5b58\u6c60\u4e2d\u8f83\u5c0f\u7684\u5206\u914d\u91cf\u6ca1\u6709\u8db3\u591f\u7684\u5185\u5b58\uff0c\u90a3\u4e48\u5c06\u5206\u914d\u4e00\u4e2a\u76f8\u540c\u5185\u5b58\u6c60\u5927\u5c0f\u7684\u65b0\u5757\uff0c\u8fd9\u4e2a\u6307\u4ee4\u4ec5\u6709\u76f8\u5f53\u6709\u9650\u7684\u6548\u679c\uff08\u6765\u6e90<a href=\"http:\/\/markmail.org\/message\/b2kmrluscevimpba\" rel=\"nofollow\">http:\/\/markmail.org\/message\/b2kmrluscevimpba<\/a>\uff09<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-defaulttype\"><\/a>default_type<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1a default_type MIME-type<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1adefault_type text\/plain<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u67d0\u4e2a\u6587\u4ef6\u5728\u6807\u51c6MIME\u89c6\u56fe\u6ca1\u6709\u6307\u5b9a\u7684\u60c5\u51b5\u4e0b\u7684\u9ed8\u8ba4MIME\u7c7b\u578b\u3002<br \/>\n\u53c2\u8003<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:httpcore#types\" rel=\"nofollow\">types<\/a>\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-directio\"><\/a>directio<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1adirectio [size|off]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1adirectio off<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u8fd9\u4e2a\u53c2\u6570\u6307\u5b9a\u5728\u8bfb\u53d6\u6587\u4ef6\u5927\u5c0f\u5927\u4e8e\u6307\u5b9a\u503c\u7684\u6587\u4ef6\u65f6\u4f7f\u7528O_DIRECT\uff08FreeBSD, Linux\uff09\uff0cF_NOCACHE\uff08Mac OS X\uff09\u6216\u8005\u8c03\u7528directio()\u51fd\u6570\uff08Solaris\uff09\uff0c\u5f53\u4e00\u4e2a\u8bf7\u6c42\u7528\u5230\u8fd9\u4e2a\u53c2\u6570\u65f6\u4f1a\u7981\u7528<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:httpcore#sendfile\" rel=\"nofollow\">sendfile<\/a>\uff0c\u901a\u5e38\u8fd9\u4e2a\u53c2\u6570\u7528\u4e8e\u5927\u6587\u4ef6\u3002directio 4m;<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-errorpage\"><\/a>error_page<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aerror_page code [ code\u2026 ] [ = | =answer-code ] uri | @named_location<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1ano<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location, location \u4e2d\u7684if\u5b57\u6bb5<br \/>\n\u8fd9\u4e2a\u53c2\u6570\u53ef\u4ee5\u4e3a\u9519\u8bef\u4ee3\u7801\u6307\u5b9a\u76f8\u5e94\u7684\u9519\u8bef\u9875\u9762error_page 404 \/404.html;<br \/>\nerror_page 502 503 504 \/50x.html;<br \/>\nerror_page 403\u00a0<a href=\"http:\/\/example.com\/forbidden.html\" rel=\"nofollow\">http:\/\/example.com\/forbidden.html<\/a>;<br \/>\nerror_page 404 = @fetch;\u540c\u6837\uff0c\u4f60\u4e5f\u53ef\u4ee5\u5c06\u539f\u6709\u7684\u54cd\u5e94\u4ee3\u7801\u4fee\u6539\u4e3a\u53e6\u4e00\u4e2a\u54cd\u5e94\u4ee3\u7801\uff0c\u4f8b\u5982\uff1aerror_page 404 =200 \/empty.gif;<br \/>\nerror_page 404 =403 \/forbidden.gif;\u53e6\u5916\u4f60\u53ef\u4ee5\u4f7f\u7528\u7b49\u53f7\uff08=\uff09\u6307\u5b9a\u4f60\u81ea\u5df1\u7f16\u5199\u7684\u9519\u8bef\u5904\u7406\u7a0b\u5e8f\u8fd4\u56de\u76f8\u5e94\u7684\u54cd\u5e94\u4ee3\u7801\uff1aerror_page 404 = \/404.php;\u5982\u679c\u5728\u91cd\u5b9a\u5411\u65f6\u4e0d\u9700\u8981\u6539\u53d8URI\uff0c\u53ef\u4ee5\u5c06\u9519\u8bef\u9875\u9762\u91cd\u5b9a\u5411\u5230\u4e00\u4e2a\u547d\u540d\u7684location\u5b57\u6bb5\u4e2d\uff1alocation \/ (<br \/>\nerror_page 404 @fallback;<br \/>\n)<\/p>\n<p>location @fallback (<br \/>\nproxy_pass\u00a0<a href=\"http:\/\/backend\/\" rel=\"nofollow\">http:\/\/backend<\/a>;<br \/>\n)<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-ifmodifiedsince\"><\/a>if_modified_since<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aif_modified_since [off|exact|before]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aif_modified_since exact<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u6307\u4ee4\uff080.7.24\uff09\u5b9a\u4e49\u5982\u4f55\u5c06\u6587\u4ef6\u6700\u540e\u4fee\u6539\u65f6\u95f4\u4e0e\u8bf7\u6c42\u5934\u4e2d\u7684\u201dIf-Modified-Since\u201d\u65f6\u95f4\u76f8\u6bd4\u8f83\u3002<\/p>\n<ul>\n<li>off \uff1a\u4e0d\u68c0\u67e5\u8bf7\u6c42\u5934\u4e2d\u7684\u201dIf-Modified-Since\u201d\uff080.7.34\uff09\u3002<\/li>\n<li>exact\uff1a\u7cbe\u786e\u5339\u914d<\/li>\n<li>before\uff1a\u6587\u4ef6\u4fee\u6539\u65f6\u95f4\u5e94\u5c0f\u4e8e\u8bf7\u6c42\u5934\u4e2d\u7684\u201dIf-Modified-Since\u201d\u65f6\u95f4<\/li>\n<\/ul>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-internal\"><\/a>internal<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1ainternal<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1ano<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1a location<br \/>\ninternal\u6307\u4ee4\u6307\u5b9a\u67d0\u4e2alocation\u53ea\u80fd\u88ab\u201c\u5185\u90e8\u7684\u201d\u8bf7\u6c42\u8c03\u7528\uff0c\u5916\u90e8\u7684\u8c03\u7528\u8bf7\u6c42\u4f1a\u8fd4\u56de\u201dNot found\u201d (404)<br \/>\n\u201c\u5185\u90e8\u7684\u201d\u662f\u6307\u4e0b\u5217\u7c7b\u578b\uff1a<\/p>\n<ul>\n<li>\u6307\u4ee4error_page\u91cd\u5b9a\u5411\u7684\u8bf7\u6c42\u3002<\/li>\n<li>ngx_http_ssi_module\u6a21\u5757\u4e2d\u4f7f\u7528include virtual\u6307\u4ee4\u521b\u5efa\u7684\u67d0\u4e9b\u5b50\u8bf7\u6c42\u3002<\/li>\n<li>ngx_http_rewrite_module\u6a21\u5757\u4e2d\u4f7f\u7528rewrite\u6307\u4ee4\u4fee\u6539\u7684\u8bf7\u6c42\u3002<\/li>\n<\/ul>\n<p>\u4e00\u4e2a\u9632\u6b62\u9519\u8bef\u9875\u9762\u88ab\u7528\u6237\u76f4\u63a5\u8bbf\u95ee\u7684\u4f8b\u5b50\uff1aerror_page 404 \/404.html;<br \/>\nlocation \/404.html {<br \/>\ninternal;<br \/>\n}<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-keepalivedisable\"><\/a>keepalive_disable<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1akeepalive_disable [ msie6 | safari | none ]\u2026<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1amsie6 safari<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u4e3a\u67d0\u4e9b\u6d4f\u89c8\u5668\u7981\u7528keepalive\uff080.9.0\u540e\u7248\u672c\u53ef\u7528\uff09\uff0c\u5728POST\u8bf7\u6c42\u540e\u7684MS Internet Explorer (6.0sp2\u4ee5\u524d\u7248\u672c)\u4e0eSafari\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f1a\u7981\u7528keepalive\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-keepalivetimeout\"><\/a>keepalive_timeout<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1akeepalive_timeout [ time ] [ time ]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1akeepalive_timeout 75<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u53c2\u6570\u7684\u7b2c\u4e00\u4e2a\u503c\u6307\u5b9a\u4e86\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u957f\u8fde\u63a5\u7684\u8d85\u65f6\u65f6\u95f4\uff0c\u8d85\u8fc7\u8fd9\u4e2a\u65f6\u95f4\uff0c\u670d\u52a1\u5668\u5c06\u5173\u95ed\u8fde\u63a5\u3002<br \/>\n\u53c2\u6570\u7684\u7b2c\u4e8c\u4e2a\u503c\uff08\u53ef\u9009\uff09\u6307\u5b9a\u4e86\u5e94\u7b54\u5934\u4e2dKeep-Alive: timeout=time\u7684time\u503c\uff0c\u8fd9\u4e2a\u503c\u53ef\u4ee5\u4f7f\u4e00\u4e9b\u6d4f\u89c8\u5668\u77e5\u9053\u4ec0\u4e48\u65f6\u5019\u5173\u95ed\u8fde\u63a5\uff0c\u4ee5\u4fbf\u670d\u52a1\u5668\u4e0d\u7528\u91cd\u590d\u5173\u95ed\uff0c\u5982\u679c\u4e0d\u6307\u5b9a\u8fd9\u4e2a\u53c2\u6570\uff0cnginx\u4e0d\u4f1a\u5728\u5e94\u7b54\u5934\u4e2d\u53d1\u9001Keep-Alive\u4fe1\u606f\u3002\uff08\u4f46\u8fd9\u5e76\u4e0d\u662f\u6307\u600e\u6837\u5c06\u4e00\u4e2a\u8fde\u63a5\u201cKeep-Alive\u201d\uff09<br \/>\n\u53c2\u6570\u7684\u8fd9\u4e24\u4e2a\u503c\u53ef\u4ee5\u4e0d\u76f8\u540c\u3002<br \/>\n\u4e0b\u9762\u5217\u51fa\u4e86\u4e00\u4e9b\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u5305\u542bKeep-Alive\u7684\u5e94\u7b54\u5934\uff1a<\/p>\n<ul>\n<li>MSIE\u548cOpera\u5c06Keep-Alive: timeout=N\u5934\u5ffd\u7565\u3002<\/li>\n<li>MSIE\u4fdd\u6301\u4e00\u4e2a\u8fde\u63a5\u5927\u7ea660-65\u79d2\uff0c\u7136\u540e\u53d1\u9001\u4e00\u4e2aTCP RST\u3002<\/li>\n<li>Opera\u5c06\u4e00\u76f4\u4fdd\u6301\u4e00\u4e2a\u8fde\u63a5\u5904\u4e8e\u6d3b\u52a8\u72b6\u6001\u3002<\/li>\n<li>Mozilla\u5c06\u4e00\u4e2a\u8fde\u63a5\u5728N\u7684\u57fa\u7840\u4e0a\u589e\u52a0\u5927\u7ea61-10\u79d2\u3002<\/li>\n<li>Konqueror\u4fdd\u6301\u4e00\u4e2a\u8fde\u63a5\u5927\u7ea6N\u79d2\u3002<\/li>\n<\/ul>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-keepaliverequests\"><\/a>keepalive_requests<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1akeepalive_requests n<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1akeepalive_requests 100<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u670d\u52a1\u5668\u4fdd\u6301\u957f\u8fde\u63a5\u7684\u8bf7\u6c42\u6570\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-largeclientheaderbuffers\"><\/a>large_client_header_buffers<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1alarge_client_header_buffers number size<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1alarge_client_header_buffers 4 4k\/8k<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server<br \/>\n\u6307\u5b9a\u5ba2\u6237\u7aef\u4e00\u4e9b\u6bd4\u8f83\u5927\u7684\u8bf7\u6c42\u5934\u4f7f\u7528\u7684\u7f13\u51b2\u533a\u6570\u91cf\u548c\u5927\u5c0f\u3002<br \/>\n\u8bf7\u6c42\u5b57\u6bb5\u4e0d\u80fd\u5927\u4e8e\u4e00\u4e2a\u7f13\u51b2\u533a\u5927\u5c0f\uff0c\u5982\u679c\u5ba2\u6237\u7aef\u53d1\u9001\u4e00\u4e2a\u6bd4\u8f83\u5927\u7684\u5934\uff0cnginx\u5c06\u8fd4\u56de\u201dRequest URI too large\u201d (414)<br \/>\n\u540c\u6837\uff0c\u8bf7\u6c42\u7684\u5934\u90e8\u6700\u957f\u5b57\u6bb5\u4e0d\u80fd\u5927\u4e8e\u4e00\u4e2a\u7f13\u51b2\u533a\uff0c\u5426\u5219\u670d\u52a1\u5668\u5c06\u8fd4\u56de\u201dBad request\u201d (400)\u3002<br \/>\n\u7f13\u51b2\u533a\u53ea\u5728\u9700\u6c42\u65f6\u5206\u5f00\u3002<br \/>\n\u9ed8\u8ba4\u4e00\u4e2a\u7f13\u51b2\u533a\u5927\u5c0f\u4e3a\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u5206\u9875\u6587\u4ef6\u5927\u5c0f\uff0c\u901a\u5e38\u662f4k\u62168k\uff0c\u5982\u679c\u4e00\u4e2a\u8fde\u63a5\u8bf7\u6c42\u6700\u7ec8\u5c06\u72b6\u6001\u8f6c\u6362\u4e3akeep-alive\uff0c\u5b83\u6240\u5360\u7528\u7684\u7f13\u51b2\u533a\u5c06\u88ab\u91ca\u653e\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-limitexcept\"><\/a>limit_except<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1alimit_except methods<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1ano<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1alocation<br \/>\n\u6307\u4ee4\u53ef\u4ee5\u5728location\u5b57\u6bb5\u4e2d\u505a\u4e00\u4e9bhttp\u52a8\u4f5c\u7684\u9650\u5236\u3002<br \/>\nngx_http_access_module\u548cngx_http_auth_basic_module\u6a21\u5757\u6709\u5f88\u5f3a\u7684\u8bbf\u95ee\u63a7\u5236\u529f\u80fd\u3002limit_except GET {<br \/>\nallow 192.168.1.0\/32;<br \/>\ndeny all;<br \/>\n}<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-limitrate\"><\/a>limit_rate<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1alimit_rate speed<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1ano<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location, location\u4e2d\u7684if\u5b57\u6bb5<br \/>\n\u9650\u5236\u5c06\u5e94\u7b54\u4f20\u9001\u5230\u5ba2\u6237\u7aef\u7684\u901f\u5ea6\uff0c\u5355\u4f4d\u4e3a\u5b57\u8282\/\u79d2\uff0c\u9650\u5236\u4ec5\u5bf9\u4e00\u4e2a\u8fde\u63a5\u6709\u6548\uff0c\u5373\u5982\u679c\u4e00\u4e2a\u5ba2\u6237\u7aef\u6253\u5f002\u4e2a\u8fde\u63a5\uff0c\u5219\u5b83\u7684\u901f\u5ea6\u662f\u8fd9\u4e2a\u503c\u4e58\u4ee5\u4e8c\u3002<br \/>\n\u7531\u4e8e\u4e00\u4e9b\u4e0d\u540c\u7684\u72b6\u51b5\uff0c\u53ef\u80fd\u8981\u5728server\u5b57\u6bb5\u6765\u9650\u5236\u90e8\u5206\u8fde\u63a5\u7684\u901f\u5ea6\uff0c\u90a3\u4e48\u8fd9\u4e2a\u53c2\u6570\u5e76\u4e0d\u9002\u7528\uff0c\u4e0d\u8fc7\u4f60\u53ef\u4ee5\u9009\u62e9\u8bbe\u7f6e$limit_rate\u53d8\u91cf\u7684\u503c\u6765\u8fbe\u5230\u76ee\u7684\uff1aserver {<br \/>\nif ($slow)<br \/>\nset $limit_rate 4k;<br \/>\n}\u540c\u6837\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6eX-Accel-Limit-Rate\u5934<a href=\"http:\/\/wiki.nginx.org\/NginxXSendfile\" rel=\"nofollow\">\uff08NginxXSendfile\uff09<\/a>\u6765\u63a7\u5236proxy_pass\u8fd4\u56de\u7684\u5e94\u7b54(<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:httpproxy\" rel=\"nofollow\">http\u4ee3\u7406\u6a21\u5757<\/a>)\u3002\u5e76\u4e14\u4e0d\u501f\u52a9X-Accel-Redirect\u5934\u6765\u5b8c\u6210\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-limitrateafter\"><\/a>limit_rate_after<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1alimit_rate_after time<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1alimit_rate_after 1m<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location, location\u4e2d\u7684if\u5b57\u6bb5<br \/>\n\u5728\u5e94\u7b54\u4e00\u90e8\u5206\u88ab\u4f20\u9012\u540e\u9650\u5236\u901f\u5ea6\uff1alimit_rate_after 1m;<br \/>\nlimit_rate 100k;<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-lingeringclose\"><\/a>lingering_close<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1alingering_close on|off|always<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1alingering_close on<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u5728socket\u4e0a\u542f\u7528SO_LINGER \u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-lingeringtime\"><\/a>lingering_time<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1alingering_time time<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1alingering_close 30s<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u5728socket\u4e0a\u542f\u7528SO_LINGER \u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-lingeringtimeout\"><\/a>lingering_timeout<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1alingering_timeout time<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1alingering_timeout 5s<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u5728socket\u4e0a\u542f\u7528SO_LINGER \u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-listen\"><\/a>listen<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1a listen address:port [ default(0.8.21\u540e\u5df2\u8fc7\u65f6) | default_server | [ backlog=num | rcvbuf=size | sndbuf=size | accept_filter=filter | deferred | bind | ipv6only=[on|off] | ssl ] ]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1alisten 80<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1aserver<br \/>\nlisten\u6307\u4ee4\u6307\u5b9a\u4e86server\u5b57\u6bb5\u4e2d\u53ef\u4ee5\u88ab\u8bbf\u95ee\u5230\u7684ip\u5730\u5740\u53ca\u7aef\u53e3\u53f7\uff0c\u53ef\u4ee5\u53ea\u6307\u5b9a\u4e00\u4e2aip\uff0c\u4e00\u4e2a\u7aef\u53e3\uff0c\u6216\u8005\u4e00\u4e2a\u53ef\u89e3\u6790\u7684\u670d\u52a1\u5668\u540d\u3002listen 127.0.0.1:8000;<br \/>\nlisten 127.0.0.1;<br \/>\nlisten 8000;<br \/>\nlisten *:8000;<br \/>\nlisten localhost:8000;ipv6\u5730\u5740\u683c\u5f0f\uff080.7.36\uff09\u5728\u4e00\u4e2a\u65b9\u62ec\u53f7\u4e2d\u6307\u5b9a\uff1alisten []:8000;<br \/>\nlisten [];\u5728linux\u4e2d\u9ed8\u8ba4\u4f7f\u7528IPv4 to IPv6\u89c6\u56fe\u5730\u5740\u683c\u5f0f\u4f7fIPv6\u7684socket<strong>\u540c\u6837\u5bf9\u5e94<\/strong>IPv4\u7684\u94fe\u8def\uff0c\u4f8b\u5982\uff0c ::ffff:&lt;IPv4\u5730\u5740\u683c\u5f0f&gt;\uff0c\u793a\u4f8b, ::ffff:192.168.0.27\u5bf9\u5e94192.168.0.27\u5230\u4e00\u4e2aIPv6\u5730\u5740\u3002<br \/>\n\u5982\u679c\u4f60\u5728listen\u6307\u4ee4\u4e2d\u542f\u7528[::]:80IPv6\u5730\u5740\u683c\u5f0f\u76d1\u542c80\u7aef\u53e3\uff0c\u5728linux\u4e2d\u9ed8\u8ba4\u5b83\u4e5f\u4f1a\u76d1\u542cIPv4\u7aef\u53e3\uff0c\u4e5f\u5c31\u610f\u5473\u7740IPv4\u548cIPv6\u7684\u5730\u5740\u90fd\u4f1a\u88ab\u76d1\u542c\uff0c\u5982\u679c\u4f60\u5728\u53e6\u5916\u4e00\u4e2a\u6307\u4ee4\u4e2d\u6307\u5b9aIPv4\u7684\u5730\u5740\uff0c\u4f60\u5c06\u4f1a\u5728\u91cd\u542fnginx\u65f6\u5f97\u5230\u4e00\u4e2a_\u201calready bind address\u201d_\u9519\u8bef\u3002<br \/>\n\u5728linux\u4e2d\uff0c\u5982\u679c\u4f60\u60f3\u8bb2IPv4\u548cIPv6\u5730\u5740\u5206\u5f00\u76d1\u542c\uff0c\u53ef\u4ee5\u901a\u8fc7\u5185\u6838\u53c2\u6570\uff1anet.ipv6.bindv6only\uff0c\u9ed8\u8ba4\u8fd9\u4e2a\u503c\u662f0\u3002\u901a\u8fc7sysctl\u5c06\u8fd9\u4e2a\u503c\u8bbe\u7f6e\u4e3a1\u3002<br \/>\n<strong>\u6ce8\u610f<\/strong>\uff1anginx\u5b9e\u4f8b\uff08\u8fdb\u7a0b\uff09\u5728\u4f60\u4fee\u6539\u4e0a\u8ff0\u53c2\u6570\u4e4b\u540e\u53ef\u80fd\u4f1a\u7ee7\u7eedIPv4\u94fe\u8def\u7684\u4f20\u8f93\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u4e00\u4e2a\u65b0\u7684\u8bbe\u7f6e\u4e3aIPv6\u548cIPv4\u5305\u5904\u7406\u65b9\u6cd5\uff0c\u8bf7\u4fee\u6539nginx\u914d\u7f6e\u6587\u4ef6\u5e76\u4e14\u91cd\u542fnginx\u3002<br \/>\n\u5982\u679c\u5728\u5176\u4ed6server\u5757\uff08vhost\uff09\u4e2d\u4f60\u60f3\u901a\u8fc7\u4e0b\u9762\u8fd9\u4e2a\u6307\u4ee4\u6765\u76d1\u542cIPv4\u7684\u5730\u5740\uff1alisten []:80;\u76d1\u542cIPv4\u7684\u5730\u5740\u5c06\u4f1a\u5931\u8d25\uff0c\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u65b9\u6cd5\u662f\u5728listen\u4e2d\uff0c\u5f53\u4f7f\u7528IPv6\u5730\u5740\u65f6\u589e\u52a0ipv6only=on\u9009\u9879\uff0c\u5e76\u4e14\u5728\u540c\u4e00\u4e2aserver\u5757\u4e2d\u5199\u4e00\u6761\u76d1\u542cIPv4\u5730\u5740\u7684\u6307\u4ee4\uff1a<br \/>\n\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u5e94\u8be5\u662f\u5728\u4f60\u4fee\u6539\u5185\u6838\u8fd0\u884c\u53c2\u6570\u4ee5\u540e\u8fdb\u884c\u3002listen []:80 ipv6only=on; # \u53ea\u76d1\u542cIPv6\u94fe\u8def<br \/>\nlisten 80; # \u8fd9\u6761\u6307\u4ee4\u5c06\u76d1\u542cIPv4\u94fe\u8def\u5728FreeBSD\u4e2d\u9ed8\u8ba4\u662f\u5c06IPv4\u548cIPv6\u5206\u79bb\u76d1\u542c\u7684\uff0c\u8fd9\u6837listen [::]:80\u4ec5\u76d1\u542cIPv6\u7684\u94fe\u8def\uff0c\u5982\u679c\u4f60\u60f3\u540c\u65f6\u8fdb\u884cIPv4\u5730\u5740\u7684\u76d1\u542c\u4f60\u53ef\u80fd\u9700\u8981\u53e6\u5916\u5199\u4e00\u6761\u6307\u4ee4\u3002<br \/>\n\u901a\u8fc7\u4f7f\u7528default ipv6only=on\u9009\u9879\u53ef\u4ee5\u5728listen\u6307\u4ee4\u4e2d\u6307\u5b9a\u4ec5\u76d1\u542cIPv6\u5730\u5740\uff0c\u8fd9\u6837\u5728\u8fd9\u4e2aserver\u5757\u4e2d\u5c31\u53ef\u4ee5\u6307\u5b9aIPv6\u76d1\u542c\u5730\u5740\uff0c\u5176\u4ed6server\u5757\u4e2d\u540c\u6837\u53ef\u4ee5\u6307\u5b9aIPv4\u5730\u5740\uff1alisten []:80;<br \/>\nlisten []:80 default_server ipv6only=on;\u5982\u679c\u53ea\u6709ip\u5730\u5740\u6307\u5b9a\uff0c\u5219\u9ed8\u8ba4\u7aef\u53e3\u4e3a80\u3002<br \/>\n\u5982\u679c\u6307\u4ee4\u6709default_server\u53c2\u6570\uff0c\u90a3\u4e48\u8fd9\u4e2aserver\u5757\u5c06\u662f\u901a\u8fc7\u201c\u5730\u5740:\u7aef\u53e3\u201d\u6765\u8fdb\u884c\u8bbf\u95ee\u7684\u9ed8\u8ba4\u670d\u52a1\u5668\uff0c\u8fd9\u5bf9\u4e8e\u4f60\u60f3\u4e3a\u90a3\u4e9b\u4e0d\u5339\u914dserver_name\u6307\u4ee4\u4e2d\u7684\u4e3b\u673a\u540d\u6307\u5b9a\u9ed8\u8ba4server\u5757\u7684\u865a\u62df\u4e3b\u673a\uff08\u57fa\u4e8e\u57df\u540d\uff09\u975e\u5e38\u6709\u7528\uff0c\u5982\u679c\u6ca1\u6709\u6307\u4ee4\u5e26\u6709default_server\u53c2\u6570\uff0c\u90a3\u4e48\u9ed8\u8ba4\u670d\u52a1\u5668\u5c06\u4f7f\u7528\u7b2c\u4e00\u4e2aserver\u5757\u3002\u57280.8.21\u7248\u672c\u4ee5\u524d\u8fd9\u4e2a\u53c2\u6570\u540d\u79f0\u4e3adefault\u3002<br \/>\nlisten\u5141\u8bb8\u4e00\u4e9b\u4e0d\u540c\u7684\u53c2\u6570\uff0c\u5373\u7cfb\u7edf\u8c03\u7528listen(2)\u548cbind(2)\u4e2d\u6307\u5b9a\u7684\u53c2\u6570\uff0c\u8fd9\u4e9b\u53c2\u6570\u5fc5\u987b\u7528\u5728default\u53c2\u6570\u4e4b\u540e\uff1a<\/p>\n<ol>\n<li>backlog=num \u2013 \u6307\u5b9a\u8c03\u7528listen(2)\u65f6backlog\u7684\u503c\uff0c\u9ed8\u8ba4\u4e3a-1\u3002<\/li>\n<li>rcvbuf=size \u2013 \u4e3a\u6b63\u5728\u76d1\u542c\u7684\u7aef\u53e3\u6307\u5b9aSO_RCVBUF\u3002<\/li>\n<li>sndbuf=size \u2013 \u4e3a\u6b63\u5728\u76d1\u542c\u7684\u7aef\u53e3\u6307\u5b9aSO_SNDBUF\u3002<\/li>\n<li>accept_filter=filter \u2013 \u6307\u5b9aaccept-filter\u3002\n<ul>\n<li>\u4ec5\u7528\u4e8eFreeBSD\uff0c\u53ef\u4ee5\u6709\u4e24\u4e2a\u8fc7\u6ee4\u5668\uff0cdataready\u4e0ehttcodeady\uff0c\u4ec5\u5728\u6700\u7ec8\u7248\u672c\u7684FreeBSD\uff08FreeBSD: 6.0, 5.4-STABLE\u4e0e4.11-STABLE\uff09\u4e0a\uff0c\u4e3a\u4ed6\u4eec\u53d1\u9001-HUP\u4fe1\u53f7\u53ef\u80fd\u4f1a\u6539\u53d8accept-filter\u3002<\/li>\n<\/ul>\n<\/li>\n<li>deferred \u2013 \u5728linux\u7cfb\u7edf\u4e0a\u5ef6\u8fdfaccept(2)\u8c03\u7528\u5e76\u4f7f\u7528\u4e00\u4e2a\u8f85\u52a9\u7684\u53c2\u6570\uff1a TCP_DEFER_ACCEPT\u3002<\/li>\n<li>bind \u2013 \u5c06bind(2)\u5206\u5f00\u8c03\u7528\u3002\n<ul>\n<li>\u4e3b\u8981\u6307\u8fd9\u91cc\u7684\u201c\u5730\u5740:\u7aef\u53e3\u201d\uff0c\u5b9e\u9645\u4e0a\u5982\u679c\u5b9a\u4e49\u4e86\u4e0d\u540c\u7684\u6307\u4ee4\u76d1\u542c\u540c\u4e00\u4e2a\u7aef\u53e3\uff0c\u4f46\u662f\u6bcf\u4e2a\u4e0d\u540c\u7684\u5730\u5740\u548c\u67d0\u6761\u6307\u4ee4\u5747\u76d1\u542c\u4e3a\u8fd9\u4e2a\u7aef\u53e3\u7684\u6240\u6709\u5730\u5740\uff08<strong>:port\uff09\uff0c\u90a3\u4e48nginx\u53ea\u5c06bind(2)\u8c03\u7528\u4e8e<\/strong>:port\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\u901a\u8fc7\u7cfb\u7edf\u8c03\u7528getsockname()\u786e\u5b9a\u54ea\u4e2a\u5730\u5740\u4e0a\u6709\u8fde\u63a5\u5230\u8fbe\uff0c\u4f46\u662f\u5982\u679c\u4f7f\u7528\u4e86parameters backlog, rcvbuf, sndbuf, accept_filter\u6216deferred\u8fd9\u4e9b\u53c2\u6570\uff0c\u90a3\u4e48\u5c06\u603b\u662f\u5c06\u8fd9\u4e2a\u201c\u5730\u5740:\u7aef\u53e3\u201d\u5206\u5f00\u8c03\u7528\u3002<\/li>\n<\/ul>\n<\/li>\n<li>ssl \u2013 \u53c2\u6570\uff080.7.14\uff09\u4e0d\u5c06listen(2)\u548cbind(2)\u7cfb\u7edf\u8c03\u7528\u5173\u8054\u3002\n<ul>\n<li>\u88ab\u6307\u5b9a\u8fd9\u4e2a\u53c2\u6570\u7684listen\u5c06\u88ab\u5141\u8bb8\u5de5\u4f5c\u5728SSL\u6a21\u5f0f\uff0c\u8fd9\u5c06\u5141\u8bb8\u670d\u52a1\u5668\u540c\u65f6\u5de5\u4f5c\u5728HTTP\u548cHTTPS\u4e24\u79cd\u534f\u8bae\u4e0b\uff0c\u4f8b\u5982\uff1alisten 80;<br \/>\nlisten 443 default_server ssl;\u4e00\u4e2a\u4f7f\u7528\u8fd9\u4e9b\u53c2\u6570\u7684\u5b8c\u6574\u4f8b\u5b50\uff1alisten 127.0.0.1 default_server accept_filter=dataready backlog=1024;0.8.21\u7248\u672c\u4ee5\u540enginx\u53ef\u4ee5\u76d1\u542cunix\u5957\u63a5\u53e3\uff1alisten unix:\/tmp\/nginx1.sock;<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-location\"><\/a>location<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1alocation [=|<sub>|<\/sub>*|^~|@] \/uri\/<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1ano<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1aserver<br \/>\n\u8fd9\u4e2a\u53c2\u6570\u6839\u636eURI\u7684\u4e0d\u540c\u9700\u6c42\u6765\u8fdb\u884c\u914d\u7f6e\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u4e32\u4e0e\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\uff0c\u5982\u679c\u8981\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u4f60\u5fc5\u987b\u6307\u5b9a\u4e0b\u5217\u524d\u7f00\uff1a<\/p>\n<ol>\n<li>~* \u4e0d\u533a\u5206\u5927\u5c0f\u5199\u3002<\/li>\n<li>~ \u533a\u5206\u5927\u5c0f\u5199\u3002<\/li>\n<\/ol>\n<p>\u8981\u786e\u5b9a\u8be5\u6307\u4ee4\u5339\u914d\u7279\u5b9a\u7684\u67e5\u8be2\uff0c\u7a0b\u5e8f\u5c06\u9996\u5148\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u5339\u914d\uff0c\u5b57\u7b26\u4e32\u5339\u914d\u5c06\u4f5c\u4e3a\u67e5\u8be2\u7684\u5f00\u59cb\uff0c\u6700\u786e\u5207\u7684\u5339\u914d\u5c06\u88ab\u4f7f\u7528\u3002\u7136\u540e\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5339\u914d\u67e5\u8be2\u5f00\u59cb\uff0c\u5339\u914d\u67e5\u8be2\u7684\u7b2c\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u627e\u5230\u540e\u4f1a\u505c\u6b62\u641c\u7d22\uff0c\u5982\u679c\u6ca1\u6709\u627e\u5230\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u5c06\u4f7f\u7528\u5b57\u7b26\u4e32\u7684\u641c\u7d22\u7ed3\u679c\u3002<br \/>\n\u5728\u4e00\u4e9b\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5982Mac OS X\u548cCygwin\uff0c\u5b57\u7b26\u4e32\u5c06\u901a\u8fc7\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u7684\u65b9\u5f0f\u5b8c\u6210\u5339\u914d\uff080.7.7\uff09\uff0c\u4f46\u662f\uff0c\u6bd4\u8f83\u4ec5\u9650\u4e8e\u5355\u5b57\u8282\u7684\u8bed\u8a00\u73af\u5883\u3002<br \/>\n\u6b63\u5219\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5305\u542b\u6355\u83b7\uff080.7.40\uff09\uff0c\u5e76\u7528\u4e8e\u5176\u5b83\u6307\u4ee4\u4e2d\u3002<br \/>\n\u53ef\u4ee5\u4f7f\u7528\u201c^~\u201d\u6807\u8bb0\u7981\u6b62\u5728\u5b57\u7b26\u4e32\u5339\u914d\u540e\u68c0\u67e5\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u5982\u679c\u6700\u786e\u5207\u7684\u5339\u914dlocation\u6709\u8fd9\u4e2a\u6807\u8bb0\uff0c\u90a3\u4e48\u6b63\u5219\u8868\u8fbe\u5f0f\u4e0d\u4f1a\u88ab\u68c0\u67e5\u3002<br \/>\n\u4f7f\u7528\u201c=\u201d\u6807\u8bb0\u53ef\u4ee5\u5728URI\u548clocation\u4e4b\u95f4\u5b9a\u4e49\u7cbe\u786e\u7684\u5339\u914d\uff0c\u5728\u7cbe\u786e\u5339\u914d\u5b8c\u6210\u540e\u5e76\u4e0d\u8fdb\u884c\u989d\u5916\u7684\u641c\u7d22\uff0c\u4f8b\u5982\u6709\u8bf7\u6c42\u201c\/\u201d\u53d1\u751f\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u201clocation = \/\u201d\u6765\u52a0\u901f\u8fd9\u4e2a\u5904\u7406\u3002<br \/>\n\u5373\u4f7f\u6ca1\u6709\u201c=\u201d\u548c\u201c^~\u201d\u6807\u8bb0\uff0c\u7cbe\u786e\u7684\u5339\u914dlocation\u5728\u627e\u5230\u540e\u540c\u6837\u4f1a\u505c\u6b62\u67e5\u8be2\u3002<br \/>\n\u4e0b\u9762\u662f\u5404\u79cd\u67e5\u8be2\u65b9\u5f0f\u7684\u603b\u7ed3\uff1a<\/p>\n<ol>\n<li>\u524d\u7f00\u201c=\u201d\u8868\u793a\u7cbe\u786e\u5339\u914d\u67e5\u8be2\uff0c\u5982\u679c\u627e\u5230\uff0c\u7acb\u5373\u505c\u6b62\u67e5\u8be2\u3002<\/li>\n<li>\u6307\u4ee4\u4ecd\u7136\u4f7f\u7528\u6807\u51c6\u5b57\u7b26\u4e32\uff0c\u5982\u679c\u5339\u914d\u4f7f\u7528\u201c^~\u201d\u524d\u7f00\uff0c\u505c\u6b62\u67e5\u8be2\u3002<\/li>\n<li>\u6b63\u5219\u8868\u8fbe\u5f0f\u6309\u7167\u4ed6\u4eec\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u5b9a\u4e49\u7684\u987a\u5e8f\u3002<\/li>\n<li>\u5982\u679c\u7b2c\u4e09\u6761\u4ea7\u751f\u4e00\u4e2a\u5339\u914d\uff0c\u8fd9\u4e2a\u5339\u914d\u5c06\u88ab\u4f7f\u7528\uff0c\u5426\u5219\u5c06\u4f7f\u7528\u7b2c\u4e8c\u6761\u7684\u5339\u914d\u3002<\/li>\n<\/ol>\n<p>\u4f8b\uff1alocation = \/ {<\/p>\n<ol>\n<li>\u53ea\u5339\u914d \/ \u7684\u67e5\u8be2.<br \/>\n[ configuration A ]<br \/>\n}<br \/>\nlocation \/ {<\/li>\n<li>\u5339\u914d\u4efb\u4f55\u4ee5 \/ \u5f00\u59cb\u7684\u67e5\u8be2\uff0c\u4f46\u662f\u6b63\u5219\u8868\u8fbe\u5f0f\u4e0e\u4e00\u4e9b\u8f83\u957f\u7684\u5b57\u7b26\u4e32\u5c06\u88ab\u9996\u5148\u5339\u914d\u3002<br \/>\n[ configuration B ]<br \/>\n}<br \/>\nlocation ^~ \/images\/ {<\/li>\n<li>\u5339\u914d\u4efb\u4f55\u4ee5 \/images\/ \u5f00\u59cb\u7684\u67e5\u8be2\u5e76\u4e14\u505c\u6b62\u641c\u7d22\uff0c\u4e0d\u68c0\u67e5\u6b63\u5219\u8868\u8fbe\u5f0f\u3002<br \/>\n[ configuration C ]<br \/>\n}<br \/>\nlocation ~* \\.(gif|jpg|jpeg)$ {<\/li>\n<li>\u5339\u914d\u4efb\u4f55\u4ee5gif, jpg, or jpeg\u7ed3\u5c3e\u7684\u6587\u4ef6\uff0c\u4f46\u662f\u6240\u6709 \/images\/ \u76ee\u5f55\u7684\u8bf7\u6c42\u5c06\u5728Configuration C\u4e2d\u5904\u7406\u3002<br \/>\n[ configuration D ]<br \/>\n}\u5404\u8bf7\u6c42\u7684\u5904\u7406\u5982\u4e0b\u4f8b\uff1a<\/li>\n<\/ol>\n<ul>\n<li>\/ \u2192 configuration A<\/li>\n<li>\/documents\/document.html \u2192 configuration B<\/li>\n<li>\/images\/1.gif \u2192 configuration C<\/li>\n<li>\/documents\/1.jpg \u2192 configuration D<\/li>\n<\/ul>\n<p>\u6ce8\u610f\u4f60\u53ef\u4ee5\u4ee5\u4efb\u4f55\u987a\u5e8f\u5b9a\u4e49\u8fd94\u4e2a\u914d\u7f6e\u5e76\u4e14\u5339\u914d\u7ed3\u679c\u662f\u76f8\u540c\u7684\uff0c\u4f46\u5f53\u4f7f\u7528\u5d4c\u5957\u7684location\u7ed3\u6784\u65f6\u53ef\u80fd\u4f1a\u5c06\u914d\u7f6e\u6587\u4ef6\u53d8\u7684\u590d\u6742\u5e76\u4e14\u4ea7\u751f\u4e00\u4e9b\u6bd4\u8f83\u610f\u5916\u7684\u7ed3\u679c\u3002<br \/>\n\u6807\u8bb0\u201c@\u201d\u6307\u5b9a\u4e00\u4e2a\u547d\u540d\u7684location\uff0c\u8fd9\u79cdlocation\u5e76\u4e0d\u4f1a\u5728\u6b63\u5e38\u8bf7\u6c42\u4e2d\u6267\u884c\uff0c\u5b83\u4eec\u4ec5\u4f7f\u7528\u5728\u5185\u90e8\u91cd\u5b9a\u5411\u8bf7\u6c42\u4e2d\u3002\uff08\u67e5\u770b<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:httpcore#error_page\" rel=\"nofollow\">error_page<\/a>\u548c<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:httpcore#try_files\" rel=\"nofollow\">try_files<\/a>\uff09<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-lognotfound\"><\/a>log_not_found<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1alog_not_found [on|off]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1alog_not_found on<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u6307\u4ee4\u6307\u5b9a\u662f\u5426\u5c06\u4e00\u4e9b\u6587\u4ef6\u6ca1\u6709\u627e\u5230\u7684\u9519\u8bef\u4fe1\u606f\u5199\u5165<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:httpcore#error_log\" rel=\"nofollow\">error_log<\/a>\u6307\u5b9a\u7684\u6587\u4ef6\u4e2d\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-logsubrequest\"><\/a>log_subrequest<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1alog_subrequest [on|off]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1alog_subrequest off<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u6307\u4ee4\u6307\u5b9a\u662f\u5426\u5c06\u4e00\u4e9b\u7ecf\u8fc7<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:rewrite#\u6458\u8981\" rel=\"nofollow\">rewrite rules<\/a>\u548c\/\u6216<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:ssi#\u6458\u8981\" rel=\"nofollow\">SSI requests<\/a>\u7684\u5b50\u8bf7\u6c42\u65e5\u5fd7\u5199\u5165<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:log#access_log\" rel=\"nofollow\">access_log<\/a>\u6307\u5b9a\u7684\u6587\u4ef6\u4e2d\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-msiepadding\"><\/a>msie_padding<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1amsie_padding [on|off]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1amsie_padding on<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u6307\u4ee4\u6307\u5b9a\u5f00\u542f\u6216\u5173\u95edMSIE\u6d4f\u89c8\u5668\u548cchrome\u6d4f\u89c8\u5668\uff080.8.25+\uff09\u7684msie_padding\u7279\u5f81\uff0c\u5f53\u8fd9\u4e2a\u529f\u80fd\u5f00\u542f\uff0cnginx\u5c06\u4e3a\u54cd\u5e94\u5b9e\u4f53\u5206\u914d\u6700\u5c0f512\u5b57\u8282\uff0c\u4ee5\u4fbf\u54cd\u5e94\u5927\u4e8e\u6216\u7b49\u4e8e400\u7684\u72b6\u6001\u4ee3\u7801\u3002<br \/>\n\u6307\u4ee4\u9884\u9632\u5728MSIE\u548cchrome\u6d4f\u89c8\u5668\u4e2d\u6fc0\u6d3b\u201c\u53cb\u597d\u7684\u201dHTTP\u9519\u8bef\u9875\u9762\uff0c\u4ee5\u4fbf\u4e0d\u5728\u670d\u52a1\u5668\u7aef\u9690\u85cf\u66f4\u591a\u7684\u9519\u8bef\u4fe1\u606f\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-msierefresh\"><\/a>msie_refresh<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1a msie_refresh [on|off]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1amsie_refresh off<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u6307\u4ee4\u5141\u8bb8\u6216\u62d2\u7edd\u4e3aMSIE\u53d1\u5e03\u4e00\u4e2arefresh\u800c\u4e0d\u662f\u505a\u4e00\u6b21redirect<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-openfilecache\"><\/a>open_file_cache<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aopen_file_cache max = N [inactive = time] | off<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aopen_file_cache off<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u8fd9\u4e2a\u6307\u4ee4\u6307\u5b9a\u7f13\u5b58\u662f\u5426\u542f\u7528\uff0c\u5982\u679c\u542f\u7528\uff0c\u5c06\u8bb0\u5f55\u6587\u4ef6\u4ee5\u4e0b\u4fe1\u606f\uff1a<\/p>\n<ul>\n<li>\u6253\u5f00\u7684\u6587\u4ef6\u63cf\u8ff0\u7b26\uff0c\u5927\u5c0f\u4fe1\u606f\u548c\u4fee\u6539\u65f6\u95f4\u3002<\/li>\n<li>\u5b58\u5728\u7684\u76ee\u5f55\u4fe1\u606f\u3002<\/li>\n<li>\u5728\u641c\u7d22\u6587\u4ef6\u8fc7\u7a0b\u4e2d\u7684\u9519\u8bef\u4fe1\u606f \u2013 \u6ca1\u6709\u8fd9\u4e2a\u6587\u4ef6\u3001\u65e0\u6cd5\u6b63\u786e\u8bfb\u53d6\uff0c\u53c2\u8003open_file_cache_errors<\/li>\n<\/ul>\n<p>\u6307\u4ee4\u9009\u9879\uff1a<\/p>\n<ul>\n<li>max &#8211; \u6307\u5b9a\u7f13\u5b58\u7684\u6700\u5927\u6570\u76ee\uff0c\u5982\u679c\u7f13\u5b58\u6ea2\u51fa\uff0c\u6700\u8fd1\u6700\u5c11\u4f7f\u7528\u7684\u6587\u4ef6\uff08LRU\uff09\u5c06\u88ab\u79fb\u9664\u3002<\/li>\n<li>inactive &#8211; \u6307\u5b9a\u7f13\u5b58\u6587\u4ef6\u88ab\u79fb\u9664\u7684\u65f6\u95f4\uff0c\u5982\u679c\u5728\u8fd9\u6bb5\u65f6\u95f4\u5185\u6587\u4ef6\u6ca1\u88ab\u4e0b\u8f7d\uff0c\u9ed8\u8ba4\u4e3a60\u79d2\u3002<\/li>\n<li>off &#8211; \u7981\u6b62\u7f13\u5b58\u3002<\/li>\n<\/ul>\n<p>\u4f8b: open_file_cache max=1000 inactive=20s;<br \/>\nopen_file_cache_valid 30s;<br \/>\nopen_file_cache_min_uses 2;<br \/>\nopen_file_cache_errors on;<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-openfilecacheerrors\"><\/a>open_file_cache_errors<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aopen_file_cache_errors on | off<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aopen_file_cache_errors off<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u8fd9\u4e2a\u6307\u4ee4\u6307\u5b9a\u662f\u5426\u5728\u641c\u7d22\u4e00\u4e2a\u6587\u4ef6\u662f\u8bb0\u5f55cache\u9519\u8bef\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-openfilecacheminuses\"><\/a>open_file_cache_min_uses<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aopen_file_cache_min_uses number<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aopen_file_cache_min_uses 1<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u8fd9\u4e2a\u6307\u4ee4\u6307\u5b9a\u4e86\u5728open_file_cache\u6307\u4ee4\u65e0\u6548\u7684\u53c2\u6570\u4e2d\u4e00\u5b9a\u7684\u65f6\u95f4\u8303\u56f4\u5185\u53ef\u4ee5\u4f7f\u7528\u7684\u6700\u5c0f\u6587\u4ef6\u6570\uff0c\u5982\u679c\u4f7f\u7528\u66f4\u5927\u7684\u503c\uff0c\u6587\u4ef6\u63cf\u8ff0\u7b26\u5728cache\u4e2d\u603b\u662f\u6253\u5f00\u72b6\u6001\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-openfilecachevalid\"><\/a>open_file_cache_valid<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aopen_file_cache_valid time<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aopen_file_cache_valid 60<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u8fd9\u4e2a\u6307\u4ee4\u6307\u5b9a\u4e86\u4f55\u65f6\u9700\u8981\u68c0\u67e5open_file_cache\u4e2d\u7f13\u5b58\u9879\u76ee\u7684\u6709\u6548\u4fe1\u606f\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-optimizeservernames\"><\/a>optimize_server_names<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aoptimize_server_names [ on|off ]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aoptimize_server_names on<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server<br \/>\n\u8fd9\u4e2a\u6307\u4ee4\u6307\u5b9a\u662f\u5426\u5728\u57fa\u4e8e\u57df\u540d\u7684\u865a\u62df\u4e3b\u673a\u4e2d\u5f00\u542f\u6700\u4f18\u5316\u7684\u4e3b\u673a\u540d\u68c0\u67e5\u3002<br \/>\n\u5c24\u5176\u662f\u68c0\u67e5\u5f71\u54cd\u5230\u4f7f\u7528\u4e3b\u673a\u540d\u7684\u91cd\u5b9a\u5411\uff0c\u5982\u679c\u5f00\u542f\u6700\u4f18\u5316\uff0c\u90a3\u4e48\u6240\u6709\u57fa\u4e8e\u57df\u540d\u7684\u865a\u62df\u4e3b\u673a\u76d1\u542c\u7684\u4e00\u4e2a\u201c\u5730\u5740\uff1a\u7aef\u53e3\u5bf9\u201d\u5177\u6709\u76f8\u540c\u7684\u914d\u7f6e\uff0c\u8fd9\u6837\u5728\u8bf7\u6c42\u6267\u884c\u7684\u65f6\u5019\u5e76\u4e0d\u8fdb\u884c\u518d\u6b21\u68c0\u67e5\uff0c\u91cd\u5b9a\u5411\u4f1a\u4f7f\u7528\u7b2c\u4e00\u4e2aserver name\u3002<br \/>\n\u5982\u679c\u91cd\u5b9a\u5411\u5fc5\u987b\u4f7f\u7528\u4e3b\u673a\u540d\u5e76\u4e14\u5728\u5ba2\u6237\u7aef\u68c0\u67e5\u901a\u8fc7\uff0c\u90a3\u4e48\u8fd9\u4e2a\u53c2\u6570\u5fc5\u987b\u8bbe\u7f6e\u4e3aoff\u3002<br \/>\n\u6ce8\u610f\uff1a\u8fd9\u4e2a\u53c2\u6570\u4e0d\u5efa\u8bae\u5728nginx 0.7.x\u7248\u672c\u4e2d\u4f7f\u7528\uff0c\u8bf7\u4f7f\u7528server_name_in_redirect\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-portinredirect\"><\/a>port_in_redirect<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aport_in_redirect [ on|off ]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aport_in_redirect on<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u8fd9\u4e2a\u6307\u4ee4\u6307\u5b9a\u662f\u5426\u5728\u8ba9nginx\u5728\u91cd\u5b9a\u5411\u64cd\u4f5c\u4e2d\u5bf9\u7aef\u53e3\u8fdb\u884c\u64cd\u4f5c\u3002<br \/>\n\u5982\u679c\u8fd9\u4e2a\u6307\u4ee4\u8bbe\u7f6e\u4e3aoff\uff0c\u5728\u91cd\u5b9a\u5411\u7684\u8bf7\u6c42\u4e2dnginx\u4e0d\u4f1a\u5728url\u4e2d\u6dfb\u52a0\u7aef\u53e3\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-postaction\"><\/a>post_action<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1apost_action [ uri|off ]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1apost_action off<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location, location\u4e2d\u7684if\u5b57\u6bb5<br \/>\n\u4e3a\u5f53\u524d\u5b8c\u6210\u8bf7\u6c42\u7684\u5b50\u8bf7\u6c42\u5b9a\u4e49\u4e00\u4e2aURI\u3002location \/protected_files {<br \/>\ninternal;<\/p>\n<p>proxy_pass\u00a0<a href=\"http:\/\/127.0.0.2\/\" rel=\"nofollow\">http:\/\/127.0.0.2<\/a>;<br \/>\npost_action \/protected_done;<br \/>\n}<\/p>\n<ol>\n<li>\u53d1\u9001post_action \u8bf7\u6c42\u5230FastCGI\u540e\u7aef\u8fdb\u884c\u767b\u5f55\u9a8c\u8bc1\u3002<br \/>\nlocation \/protected_done {<br \/>\ninternal;<br \/>\nfastcgi_pass 127.0.0.1:9000;<br \/>\n}<\/li>\n<\/ol>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-recursiveerrorpages\"><\/a>recursive_error_pages<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1arecursive_error_pages [on|off]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1arecursive_error_pages off<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\nrecursive_error_pages\u6307\u5b9a\u542f\u7528\u9664\u7b2c\u4e00\u6761error_page\u6307\u4ee4\u4ee5\u5916\u5176\u4ed6\u7684error_page\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-requestpoolsize\"><\/a>request_pool_size<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1arequest_pool_size the_size<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1arequest_pool_size the_size 256<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp (\u6216\u8bb8\u53ef\u4ee5\u7528\u5230\u5176\u4ed6\u5730\u65b9?)<br \/>\n\u4e3a\u6bcf\u4e2a\u8bf7\u6c42\u5206\u914d\u7684\u5185\u5b58\u6c60\uff0c\u5185\u5b58\u6c60\u7528\u4e8e\u5c0f\u914d\u989d\u5185\u5b58\u5757\uff0c\u5982\u679c\u4e00\u4e2a\u5757\u5927\u4e8e\u5185\u5b58\u6c60\u6216\u8005\u5927\u4e8e\u5206\u9875\u5927\u5c0f\uff0c\u90a3\u4e48\u5b83\u5c06\u88ab\u5206\u914d\u5230\u5185\u5b58\u6c60\u4e4b\u5916\uff0c\u5982\u679c\u4f4d\u4e8e\u5185\u5b58\u6c60\u4e2d\u8f83\u5c0f\u7684\u5206\u914d\u91cf\u6ca1\u6709\u8db3\u591f\u7684\u5185\u5b58\uff0c\u90a3\u4e48\u5c06\u5206\u914d\u4e00\u4e2a\u76f8\u540c\u5185\u5b58\u6c60\u5927\u5c0f\u7684\u65b0\u5757\uff0c\u8fd9\u4e2a\u6307\u4ee4\u4ec5\u6709\u76f8\u5f53\u6709\u9650\u7684\u6548\u679c\uff08\u6765\u6e90<a href=\"http:\/\/markmail.org\/message\/b2kmrluscevimpba\" rel=\"nofollow\">http:\/\/markmail.org\/message\/b2kmrluscevimpba<\/a>\uff09<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-resettimedoutconnection\"><\/a>reset_timedout_connection<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1areset_timedout_connection [on|off]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1areset_timedout_connection off<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u662f\u5426\u542f\u7528\u91cd\u7f6etimeout\u7684\u8fde\u63a5\uff0c\u5728socket\u5173\u95ed\u5e76\u4e14\u91cd\u7f6e\u8fde\u63a5\u65f6\uff0csocket\u7684SO_LINGER\u9009\u9879\u8bbe\u7f6e\u4e3a0timeout\uff0c\u8fd9\u5c06\u5f3a\u8febRST\u5305\u53d1\u9001\u5230\u5ba2\u6237\u7aef\u540e\u5173\u95ed\u8fde\u63a5\uff0c\u4ece\u800c\u91ca\u653e\u4e0e\u4e4b\u5173\u8054\u7684\u5185\u5b58\uff0c\u8fd9\u662fsocket\u5904\u4e8eFIN_WAIT1\u72b6\u6001\u3002<br \/>\n\u6ce8\u610f\u5982\u679csocket\u4f7f\u7528keepalive\u8fde\u63a5\uff0c\u5728\u7ecf\u8fc7\u5b9a\u4e49\u7684timeout\u65f6\u95f4\u540e\uff0c\u5c06\u4f7f\u7528\u6b63\u5e38\u7684\u65b9\u5f0f\u5173\u95ed\u8fde\u63a5\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-resolver\"><\/a>resolver<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aresolver address<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1ano<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u6307\u5b9aDNS\u670d\u52a1\u5668\u5730\u5740\uff0c\u5982\uff1aresolver 127.0.0.1;<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-resolvertimeout\"><\/a>resolver_timeout<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aresolver_timeout time<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1a30s<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u89e3\u6790\u8d85\u65f6\u65f6\u95f4\u3002\u5982\uff1aresolver_timeout 5s;<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-root\"><\/a>root<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aroot path<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aroot html<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location ,location\u4e2d\u7684if\u5b57\u6bb5<br \/>\n\u8bf7\u6c42\u5230\u8fbe\u540e\u7684\u6587\u4ef6\u6839\u76ee\u5f55\u3002<br \/>\n\u4e0b\u4f8b\u4e2d\uff1alocation \/i\/ {<br \/>\nroot \/spool\/w3;<br \/>\n}\u5982\u679c\u8bf7\u6c42\u201d\/i\/top.gif\u201d\u6587\u4ef6\uff0cnginx\u5c06\u8f6c\u5230\u201d\/spool\/w3\/i\/top.gif\u201d\u6587\u4ef6\u3002\u4f60\u53ef\u4ee5\u5728\u53c2\u6570\u4e2d\u4f7f\u7528\u53d8\u91cf\u3002<br \/>\n\u6ce8\u610f\uff1a\u5728\u8bf7\u6c42\u4e2droot\u4f1a\u6dfb\u52a0\u8fd9\u4e2alocation\u5230\u5b83\u7684\u503c\u540e\u9762\uff0c\u5373\u201d\/i\/top.gif\u201d\u5e76\u4e0d\u4f1a\u8bf7\u6c42\u201d\/spool\/w3\/top.gif\u201d\u6587\u4ef6\uff0c\u5982\u679c\u8981\u5b9e\u73b0\u4e0a\u8ff0\u7c7b\u4f3c\u4e8eapache alias\u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u4f7f\u7528alias\u6307\u4ee4\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-satisfy\"><\/a>satisfy<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1a satisfy [ all | any ]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1a satisfy all<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n<strong>\u53ef\u7528\u7248\u672c<\/strong>\uff1a \u2265 0.6.25<br \/>\n\u5982\u679c\u5728\u4e00\u4e2a\u5b57\u6bb5\u4e2d\u540c\u65f6\u4f7f\u7528\u4e86<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:httpaccess\" rel=\"nofollow\">Access\u6a21\u5757<\/a>\u548c<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:httpauthbasic\" rel=\"nofollow\">Auth Basic\u6a21\u5757<\/a>\u7684\u6307\u4ee4\uff0c\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u6307\u4ee4\u786e\u5b9a\u4e00\u79cd\u9a8c\u8bc1\u65b9\u5f0f\uff1a<\/p>\n<ul>\n<li>all &#8211; \u5fc5\u987b\u540c\u65f6\u5339\u914dAccess<strong>\u548c<\/strong>Auth Basic\u4e2d\u6307\u4ee4\u6307\u5b9a\u7684\u6743\u9650\u3002<\/li>\n<li>any &#8211; \u5177\u6709Access\u00a0<strong>\u6216<\/strong>\u00a0Auth Basic\u6307\u4ee4\u4efb\u4e00\u6743\u9650\u5373\u53ef\u901a\u8fc7\u5339\u914dlocation \/ {<br \/>\nsatisfy any;<br \/>\nallow 192.168.1.0\/32;<br \/>\ndeny all;<br \/>\nauth_basic &#8220;closed site&#8221;;<br \/>\nauth_basic_user_file conf\/htpasswd;<br \/>\n}<\/li>\n<\/ul>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-satisfyany\"><\/a>satisfy_any<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1asatisfy_any [ on|off ]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1asatisfy_any off<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1alocation<br \/>\n0.6.25\u7248\u672c\u4ee5\u540e\u8bf7\u4f7f\u7528<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:httpcore#satisfy\" rel=\"nofollow\">satisfy<\/a><\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-sendtimeout\"><\/a>send_timeout<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1asend_timeout the time<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1asend_timeout 60<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u6307\u4ee4\u6307\u5b9a\u4e86\u53d1\u9001\u7ed9\u5ba2\u6237\u7aef\u5e94\u7b54\u540e\u7684\u8d85\u65f6\u65f6\u95f4\uff0cTimeout\u662f\u6307\u6ca1\u6709\u8fdb\u5165\u5b8c\u6574established\u72b6\u6001\uff0c\u53ea\u5b8c\u6210\u4e86\u4e24\u6b21\u63e1\u624b\uff0c\u5982\u679c\u8d85\u8fc7\u8fd9\u4e2a\u65f6\u95f4\u5ba2\u6237\u7aef\u6ca1\u6709\u4efb\u4f55\u54cd\u5e94\uff0cnginx\u5c06\u5173\u95ed\u8fde\u63a5\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-sendfile\"><\/a>sendfile<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1asendfile [ on|off ]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1asendfile off<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u662f\u5426\u542f\u7528sendfile()\u51fd\u6570\u3002<br \/>\nsendfile()\u51fd\u6570\u5728\u4e00\u4e2a\u6587\u4ef6\u63cf\u8ff0\u7b26\u4e0e\u53e6\u4e00\u4e2a\u4e4b\u95f4\u62f7\u8d1d\u6570\u636e\uff0c\u7531\u4e8e\u8fd9\u4e2a\u62f7\u8d1d\u8fc7\u7a0b\u662f\u5728\u5185\u6838\u72b6\u6001\u4e0b\u5b8c\u6210\uff0csendfile()\u51fd\u6570\u6bd4read(2)\u548cwrite(2)\u51fd\u6570\u66f4\u52a0\u9ad8\u6548\uff0c\u540e\u8005\u9700\u8981\u4ece\u7528\u6237\u7a7a\u95f4\u4e2d\u4f20\u9001\u6587\u4ef6\u3002<br \/>\n\u66f4\u591asendfile\u4fe1\u606f\uff1a<a href=\"https:\/\/www.kernel.org\/doc\/man-pages\/online\/pages\/man2\/sendfile.2.html\" rel=\"nofollow\">https:\/\/www.kernel.org\/doc\/man-pages\/online\/pages\/man2\/sendfile.2.html<\/a><br \/>\n\u4f7f\u7528sendfile\u4f18\u5316\u6027\u80fd\uff1a<a href=\"http:\/\/www.techrepublic.com\/article\/use-sendfile-to-optimize-data-transfer\/1044112\" rel=\"nofollow\">http:\/\/www.techrepublic.com\/article\/use-sendfile-to-optimize-data-transfer\/1044112<\/a><\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-server\"><\/a>server<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aserver<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1ano<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp<br \/>\nserver\u5b57\u6bb5\u5305\u542b\u865a\u62df\u4e3b\u673a\u7684\u914d\u7f6e\u3002<br \/>\n\u6ca1\u6709\u660e\u786e\u7684\u673a\u5236\u6765\u5206\u5f00\u57fa\u4e8e\u57df\u540d\uff08\u8bf7\u6c42\u4e2d\u7684\u4e3b\u673a\u5934\uff09\u548c\u57fa\u4e8eIP\u7684\u865a\u62df\u4e3b\u673a\u3002<br \/>\n\u53ef\u4ee5\u901a\u8fc7listen\u6307\u4ee4\u6765\u6307\u5b9a\u5fc5\u987b\u8fde\u63a5\u5230\u8fd9\u4e2aserver\u5757\u7684\u6240\u6709\u5730\u5740\u548c\u7aef\u53e3\uff0c\u5e76\u4e14\u5728server_name\u6307\u4ee4\u4e2d\u53ef\u4ee5\u6307\u5b9a\u6240\u6709\u7684\u57df\u540d\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-servername\"><\/a>server_name<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aserver_name name [\u2026 ]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aserver_name hostname<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1aserver<br \/>\n\u8fd9\u4e2a\u6307\u4ee4\u6709\u4e24\u4e2a\u4f5c\u7528\uff1a<br \/>\n\u4e00\u3001\u5c06HTTP\u8bf7\u6c42\u7684\u4e3b\u673a\u5934\u4e0e\u5728nginx\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684server\u5b57\u6bb5\u4e2d\u6307\u5b9a\u7684\u53c2\u6570\u8fdb\u884c\u5339\u914d\uff0c\u5e76\u4e14\u627e\u51fa\u7b2c\u4e00\u4e2a\u5339\u914d\u7ed3\u679c\u3002\u8fd9\u5c31\u662f\u5982\u4f55\u5b9a\u4e49\u865a\u62df\u4e3b\u673a\u7684\u65b9\u6cd5\uff0c\u57df\u540d\u9075\u5faa\u4e0b\u8ff0\u4f18\u5148\u7ea7\u89c4\u5219\uff1a<\/p>\n<ol>\n<li>\u5b8c\u6574\u5339\u914d\u7684\u540d\u79f0\u3002<\/li>\n<li>\u540d\u79f0\u5f00\u59cb\u4e8e\u4e00\u4e2a\u6587\u4ef6\u901a\u914d\u7b26\uff1a*.example.com\u3002<\/li>\n<li>\u540d\u79f0\u7ed3\u675f\u4e8e\u4e00\u4e2a\u6587\u4ef6\u901a\u914d\u7b26\uff1awww.example.*\u3002<\/li>\n<li>\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u540d\u79f0\u3002<\/li>\n<\/ol>\n<p>\u5982\u679c\u6ca1\u6709\u5339\u914d\u7684\u7ed3\u679c\uff0cnginx\u914d\u7f6e\u6587\u4ef6\u5c06\u5b89\u88c5\u4ee5\u4e0b\u4f18\u5148\u7ea7\u4f7f\u7528server server\u5b57\u6bb5\uff1a<\/p>\n<ol>\n<li>listen\u6307\u4ee4\u88ab\u6807\u8bb0\u4e3adefault\u7684server\u5b57\u6bb5\u3002<\/li>\n<li>\u7b2c\u4e00\u4e2a\u51fa\u73b0listen\uff08\u6216\u8005\u9ed8\u8ba4\u7684listen 80\uff09\u7684server\u5b57\u6bb5\u3002<\/li>\n<\/ol>\n<p>\u4e8c\u3001\u5982\u679cserver_name_in_redirect\u88ab\u8bbe\u7f6e\uff0c\u8fd9\u4e2a\u6307\u4ee4\u5c06\u7528\u4e8e\u8bbe\u7f6eHTTP\u91cd\u5b9a\u5411\u7684\u670d\u52a1\u5668\u540d\u3002<br \/>\n\u4f8b\uff1aserver {<br \/>\nserver_name example.com www.example.com;<br \/>\n}\u7b2c\u4e00\u4e2a\u540d\u79f0\u4e3a\u670d\u52a1\u5668\u7684\u57fa\u672c\u540d\u79f0\uff0c\u9ed8\u8ba4\u540d\u79f0\u4e3a\u673a\u5668\u7684hostname\u3002<br \/>\n\u5f53\u7136\uff0c\u53ef\u4ee5\u4f7f\u7528\u6587\u4ef6\u901a\u914d\u7b26\uff1aserver {<br \/>\nserver_name example.com\u00a0<strong>.example.com www.example.<\/strong>;<br \/>\n}\u4e0a\u8ff0\u4f8b\u5b50\u4e2d\u7684\u524d\u4e24\u4e2a\u540d\u79f0\u53ef\u4ee5\u5408\u5e76\u4e3a\u4e00\u4e2a\uff1aserver {<br \/>\nserver_name .example.com;<br \/>\n}\u540c\u6837\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u3002\u540d\u79f0\u524d\u9762\u52a0\u201c~\u201d\uff1aserver {<br \/>\nserver_name www.example.com ~^www\\d+\\.example\\.com$;<br \/>\n}0.7.12\u7248\u672c\u4ee5\u540e\u5df2\u7ecf\u53ef\u4ee5\u652f\u6301\u7a7a\u670d\u52a1\u5668\u540d\uff0c\u4ee5\u5904\u7406\u90a3\u4e9b\u6ca1\u6709\u4e3b\u673a\u5934\u7684\u8bf7\u6c42\uff0c\u4f46\u662f\u8bf7\u6ce8\u610f\uff0c\u5927\u591a\u6570\u7684\u6d4f\u89c8\u5668\u4f1a\u4e3a\u8bf7\u6c42\u589e\u52a0\u4e00\u4e2a\u201cHost\u201d\u5934\uff0c\u5982\u679c\u5176\u8fde\u63a5\u5305\u542bIP\uff0c\u8bf7\u901a\u8fc7listen\u6307\u4ee4\u7ed9\u4ed6\u6307\u5b9a\u4e00\u4e2a\u9ed8\u8ba4\u76d1\u542c\u7684server\u5757\u3002server {<br \/>\nserver_name &#8220;&#8221;;<br \/>\n}0.8.25\u7248\u672c\u4ee5\u540e\u53ef\u4ee5\u5728server_name\u4e2d\u4f7f\u7528\u547d\u540d\u7684\u6355\u83b7\uff1aserver {<br \/>\nserver_name ~^(www\\.)?(?&lt;domain&gt;.+)$;<br \/>\nroot \/sites\/$domain;<br \/>\n}\u4e00\u4e9b\u8001\u7684PCRE\u7248\u672c\u5728\u4f7f\u7528\u6b64\u8bed\u6cd5\u7684\u65f6\u5019\u53ef\u80fd\u4f1a\u5f15\u8d77\u90e8\u5206\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u8bed\u6cd5\u4fee\u590d\uff1aserver {<br \/>\nserver_name ~^(www\\.)?(?P&lt;domain&gt;.+)$;<br \/>\nroot \/sites\/$domain;<br \/>\n}0.9.4\u7248\u672c\uff08\u542b\uff09\u4ee5\u540e\uff0c<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:httpcore#hostname\" rel=\"nofollow\">$hostname<\/a>\u53d8\u91cf\u53ef\u4ee5\u4f5c\u4e3aserver_name\u7684\u53c2\u6570\uff1aserver {<br \/>\nserver_name $hostname;<br \/>\n}<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-servernameinredirect\"><\/a>server_name_in_redirect<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aserver_name_in_redirect on|off<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aserver_name_in_redirect on<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u5982\u679c\u8fd9\u4e2a\u6307\u4ee4\u6253\u5f00\uff0cnginx\u5c06\u4f7f\u7528<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:httpcore#server_name\" rel=\"nofollow\">server_name<\/a>\u6307\u5b9a\u7684\u57fa\u672c\u670d\u52a1\u5668\u540d\u4f5c\u4e3a\u91cd\u5b9a\u5411\u5730\u5740\uff0c\u5982\u679c\u5173\u95ed\uff0cnginx\u5c06\u4f7f\u7528\u8bf7\u6c42\u4e2d\u7684\u4e3b\u673a\u5934\u3002<br \/>\n\u6ce8\u610f\uff1a\u5982\u679c\u4e00\u4e2aheader\u4e2d\u7684Location\u5b57\u6bb5\u6765\u81ea\u4e00\u4e2a\u4e0a\u6e38\u4ee3\u7406\u670d\u52a1\u5668\uff08\u4f8b\u5982\u901a\u8fc7proxy_pass\uff09\uff0c\u53ef\u80fd\u4e0d\u5e76\u4e0d\u4ec5\u4ec5\u9700\u8981\u8fd9\u4e2a\u6307\u4ee4\uff0c\u4e8b\u5b9e\u4e0a\uff0c\u5b83\u4f1a\u88ab\u5ffd\u7565\uff0c\u5982\u679c\u4f60\u770b\u5230\u8fd4\u56de\u7684\u4e0a\u6e38\u670d\u52a1\u5668\u7684\u670d\u52a1\u5668\u540d\u6ca1\u6709\u7ecf\u8fc7\u91cd\u5199\uff0c\u4f60\u9700\u8981\u4f7f\u7528<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:httpproxy#proxy_redirect\" rel=\"nofollow\">proxy_redirect<\/a>\u6765\u91cd\u5199\u4e0a\u6e38\u670d\u52a1\u5668\u63d0\u4f9b\u7684\u670d\u52a1\u5668\u540d\u79f0\uff0c\u4f8b\u5982\uff1aproxy_redirect\u00a0<a href=\"http:\/\/some.upstream.url\/\" rel=\"nofollow\">http:\/\/some.upstream.url\/<\/a>\u00a0\/\uff0c\u5b83\u5c06<a href=\"http:\/\/some.upstream.url\/\" rel=\"nofollow\">http:\/\/some.upstream.url\/<\/a>\u91cd\u5199\u4e3a\u201d\/\u201c\uff0c\u8fd9\u662f\u4e00\u4e2a\u76f8\u5bf9\u8def\u5f84<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-servernameshashmaxsize\"><\/a>server_names_hash_max_size<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aserver_names_hash_max_size number<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aserver_names_hash_max_size 512<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp<br \/>\n\u670d\u52a1\u5668\u540d\u79f0\u54c8\u5e0c\u8868\u7684\u6700\u5927\u503c\uff0c\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u8003<a href=\"http:\/\/www.howtocn.org\/nginx:optimizations\" rel=\"nofollow\">nginx\u90e8\u5206\u4f18\u5316<\/a>\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-servernameshashbucketsize\"><\/a>server_names_hash_bucket_size<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aserver_names_hash_bucket_size number<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aserver_names_hash_bucket_size 32\/64\/128<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp<br \/>\n\u670d\u52a1\u5668\u540d\u79f0\u54c8\u5e0c\u8868\u6bcf\u4e2a\u9875\u6846\u7684\u5927\u5c0f\uff0c\u8fd9\u4e2a\u6307\u4ee4\u7684\u9ed8\u8ba4\u503c\u4f9d\u8d56\u4e8ecpu\u7f13\u5b58\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u8003<a href=\"http:\/\/www.howtocn.org\/nginx:optimizations\" rel=\"nofollow\">nginx\u90e8\u5206\u4f18\u5316<\/a>\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-servertokens\"><\/a>server_tokens<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aserver_tokens on|off<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aserver_tokens on<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u662f\u5426\u5728\u9519\u8bef\u9875\u9762\u548c\u670d\u52a1\u5668\u5934\u4e2d\u8f93\u51fanginx\u7248\u672c\u4fe1\u606f\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-tcpnodelay\"><\/a>tcp_nodelay<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1atcp_nodelay [on|off]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1atcp_nodelay on<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u8fd9\u4e2a\u6307\u4ee4\u6307\u5b9a\u662f\u5426\u4f7f\u7528socket\u7684TCP_NODELAY\u9009\u9879\uff0c\u8fd9\u4e2a\u9009\u9879\u53ea\u5bf9keep-alive\u8fde\u63a5\u6709\u6548\u3002<br \/>\n\u70b9\u51fb<a href=\"http:\/\/wiki.nginx.org\/ReadMoreAboutTcpNodelay\" rel=\"nofollow\">\u8fd9\u91cc<\/a>\u4e86\u89e3\u66f4\u591a\u5173\u4e8eTCP_NODELAY\u9009\u9879\u7684\u4fe1\u606f\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-tcpnopush\"><\/a>tcp_nopush<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1atcp_nopush [on|off]<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1atcp_nopush off<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u8fd9\u4e2a\u6307\u4ee4\u6307\u5b9a\u662f\u5426\u4f7f\u7528socket\u7684TCP_NOPUSH\uff08FreeBSD\uff09\u6216TCP_CORK\uff08linux\uff09\u9009\u9879\uff0c\u8fd9\u4e2a\u9009\u9879\u53ea\u5728\u4f7f\u7528sendfile\u65f6\u6709\u6548\u3002<br \/>\n\u8bbe\u7f6e\u8fd9\u4e2a\u9009\u9879\u7684\u5c06\u5bfc\u81f4nginx\u8bd5\u56fe\u5c06\u5b83\u7684HTTP\u5e94\u7b54\u5934\u5c01\u88c5\u5230\u4e00\u4e2a\u5305\u4e2d\u3002<br \/>\n\u70b9\u51fb<a href=\"http:\/\/wiki.nginx.org\/ReadMoreAboutTcpNopush\" rel=\"nofollow\">\u8fd9\u91cc<\/a>\u67e5\u770b\u5173\u4e8eTCP_NOPUSH\u548cTCP_CORK\u9009\u9879\u7684\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-tryfiles\"><\/a>try_files<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1atry_files path1 [path2] uri<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1anone<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1aserver, location<br \/>\n\u53ef\u7528\u7248\u672c\uff1a0.7.27<br \/>\n\u6309\u7167\u6307\u5b9a\u7684\u987a\u5e8f\u68c0\u67e5\u5b58\u5728\u7684\u6587\u4ef6\uff0c\u5e76\u4e14\u8fd4\u56de\u7b2c\u4e00\u4e2a\u627e\u5230\u7684\u7ed3\u679c\uff0c\u5c3e\u90e8\u8ddf\u968f\u4e00\u4e2a\u76ee\u5f55\u540d\uff0c\u5982\u679c\u6240\u6709\u7684\u6587\u4ef6\u90fd\u6ca1\u6709\u627e\u5230\uff0c\u90a3\u4e48\u5c06\u542f\u7528\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u547d\u540d\u7684\u5185\u90e8\u91cd\u5b9a\u5411\uff0c\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u6240\u6307\u5b9a\u7684\u547d\u540dlocation\u5fc5\u987b\u88ab\u8bbe\u7f6e\uff0c\u5426\u5219\u5c06\u4ea7\u751f\u4e00\u4e2a\u5185\u90e8\u9519\u8bef\u3002\u4e0d\u50cfrewrite\uff0c\u5982\u679c$args\u53d8\u91cf\u5e76\u4e0d\u4f1a\u81ea\u52a8\u4fdd\u7559\uff0c\u5982\u679c\u4f60\u9700\u8981\u4fdd\u7559\u8bf7\u6c42\u53c2\u6570\uff0c\u8bf7\u53c2\u7167\u5982\u4e0b\u914d\u7f6e\uff1atry_files $uri $uri\/ \/index.php?q=$uri&amp;$args;\u4f8b\uff08\u5728\u4ee3\u7406Mongrel\u65f6\u4f7f\u7528\uff09\uff1atry_files \/system\/maintenance.html $uri $uri\/index.html $uri.html @mongrel;<\/p>\n<p>location @mongrel {<br \/>\nproxy_pass\u00a0<a href=\"http:\/\/mongrel\/\" rel=\"nofollow\">http:\/\/mongrel<\/a>;<br \/>\n}\u6ce8\u610f\uff0c0.7.51\u7248\u672c\u540e\u4f60\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2aHTTP\u72b6\u6001\u4ee3\u7801\u5728try_file\u7684\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u4e2d\uff0c\u4f8b\u5982\uff1alocation \/ {<br \/>\ntry_files $uri $uri\/ \/error.php?c=404 =404;<br \/>\n}\u5f53\u53c2\u6570\u4e2d\u7684\u8bf7\u6c42(\u9664\u6700\u540e\u4e00\u4e2a\u5916)\u90fd\u6ca1\u6709\u6b63\u5e38\u54cd\u5e94\uff0c\u90a3\u4e48\u5c06\u8fd4\u56de404\u3002<br \/>\n\u5728Drupal \/ FastCGI\u4e2d\u4f7f\u7528# for drupal 6:<br \/>\ntry_files $uri $uri\/ @drupal;<\/p>\n<ol>\n<li>for drupal 7:<br \/>\ntry_files $uri $uri\/ \/index.php?q=$request_uri;<\/li>\n<\/ol>\n<ol>\n<li>only needed for Drupal 6 (\u6216\u8005\u4f60\u9700\u8981\u4e00\u4e2a\u547d\u540d\u7684location)<br \/>\nlocation @drupal {<br \/>\nrewrite ^ \/index.php?q=$uri last; # for drupal 6<br \/>\n}<\/li>\n<\/ol>\n<p>location ~ \\.php$ {<br \/>\nfastcgi_pass 127.0.0.1:8888;<br \/>\nfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # if not already defined in the fastcgi_params file<\/p>\n<ol>\n<li>any other specific fastcgi_params<br \/>\n}\u4e0b\u9762\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6307\u4ee4try_files\uff1alocation \/ {<br \/>\ntry_files $uri $uri\/ @drupal;<br \/>\n}\u76f8\u5f53\u4e8e\u8fd9\u4e2a\u6307\u4ee4\uff1alocation \/ {<br \/>\nerror_page 404 = @drupal;<br \/>\nlog_not_found off;<br \/>\n}\u6216\u8005\u8fd9\u4e2a\uff1aif (-e $request_filename) {<br \/>\nrewrite ^ \/index.php?q=$uri last;<br \/>\n}try_files\u57fa\u672c\u4e0a\u662f\u4e00\u4e2a\u5bf9\u68c0\u67e5\u662f\u5426\u5b58\u5728mod_rewrite\u6837\u5f0f\u7684\u6587\u4ef6\uff08\u7c7b\u4f3c\u4e8e\/directory\uff09\u7684\u66ff\u6362\uff0c\u5b83\u6bd4if\u7684\u6548\u7387\u66f4\u9ad8\uff0c\u53c2\u8003<a href=\"http:\/\/wiki.nginx.org\/IfIsEvil\" rel=\"nofollow\">IfIsEvil<\/a>\u3002<br \/>\n\u5728Wordcodess\u548cJoomla\u4e2d\u4f7f\u7528\uff1a# wordcodess (\u4e0d\u4f7f\u7528WP Super Cache) &#8211; \u793a\u4f8b 1<br \/>\ntry_files $uri $uri\/ \/index.php?q=$uri&amp;$args;<\/li>\n<\/ol>\n<ol>\n<li>wordcodess (\u4e0d\u4f7f\u7528WP Super Cache) &#8211; \u793a\u4f8b 2 (\u5b9e\u9645\u4e0a\u5e76\u4e0d\u9700\u8981&#8221;q&#8221;\u53c2\u6570)<br \/>\ntry_files $uri $uri\/ \/index.php;<\/li>\n<\/ol>\n<ol>\n<li>joomla<br \/>\ntry_files $uri $uri\/ \/index.php?q=$uri&amp;$args;<\/li>\n<\/ol>\n<p>location ~ \\.php$ {<br \/>\nfastcgi_pass 127.0.0.1:8888;<br \/>\nfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # \u5982\u679c\u5728fastcgi_params\u6587\u4ef6\u4e2d\u6ca1\u6709\u5b9a\u4e49<\/p>\n<ol>\n<li>\u5176\u4ed6\u4e00\u4e9b\u6307\u5b9a\u7684fastcgi_params.<br \/>\n}WP Super Cache\u9700\u8981\u6210\u5806\u7684\u9759\u6001\u6587\u4ef6\u68c0\u67e5\uff0c\u8fd9\u91cc\u4e0d\u5bf9\u5176\u8fdb\u884c\u8ba8\u8bba\u3002<\/li>\n<\/ol>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-types\"><\/a>types<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1atypes<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server, location<br \/>\n\u8fd9\u4e2a\u5b57\u6bb5\u6307\u5b9a\u4e00\u4e9b\u6269\u5c55\u7684\u6587\u4ef6\u5bf9\u5e94\u65b9\u5f0f\u4e0e\u5e94\u7b54\u7684MIME\u7c7b\u578b\uff0c\u4e00\u4e2aMIME\u7c7b\u578b\u53ef\u4ee5\u6709\u4e00\u4e9b\u4e0e\u5176\u7c7b\u4f3c\u7684\u6269\u5c55\u3002\u9ed8\u8ba4\u4f7f\u7528\u4ee5\u4e0b\u6587\u4ef6\u5bf9\u5e94\u65b9\u5f0f\uff1atypes {<br \/>\ntext\/html html;<br \/>\nimage\/gif gif;<br \/>\nimage\/jpeg jpg;<br \/>\n}\u5b8c\u6574\u7684\u5bf9\u5e94\u89c6\u56fe\u6587\u4ef6\u4e3aconf\/mime.types\uff0c\u5e76\u4e14\u5c06\u88ab\u5305\u542b\u3002<br \/>\n\u5982\u679c\u4f60\u60f3\u8ba9\u67d0\u4e9b\u7279\u5b9a\u7684location\u7684\u5904\u7406\u65b9\u5f0f\u4f7f\u7528MIME\u7c7b\u578b\uff1aapplication\/octet-stream\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u914d\u7f6e\uff1alocation \/download\/ {<br \/>\ntypes { }<br \/>\ndefault_type application\/octet-stream;<br \/>\n}<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-underscoresinheaders\"><\/a>underscores_in_headers<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1aunderscores_in_headers on|off<br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1aoff<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp, server<br \/>\n\u662f\u5426\u5141\u8bb8\u5728header\u7684\u5b57\u6bb5\u4e2d\u5e26\u4e0b\u5212\u7ebf\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-variableshashbucketsize\"><\/a>variables_hash_bucket_size<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1avariables_hash_bucket_size\u00a0<em>size<\/em><br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1avariables_hash_bucket_size 64<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp<br \/>\n<strong>\u53d8\u91cf<\/strong>\uff1a\u65e0<br \/>\n\u4e3a\u53d8\u91cf\u54c8\u5e0c\u8868\u6307\u5b9a\u5173\u952e\u5b57\u680f\u5927\u5c0f\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-variableshashmaxsize\"><\/a>variables_hash_max_size<\/h3>\n<p><strong>\u8bed\u6cd5<\/strong>\uff1avariables_hash_max_size\u00a0<em>size<\/em><br \/>\n<strong>\u9ed8\u8ba4\u503c<\/strong>\uff1avariables_hash_max_size 512<br \/>\n<strong>\u4f7f\u7528\u5b57\u6bb5<\/strong>\uff1ahttp<br \/>\n<strong>\u53d8\u91cf<\/strong>\uff1a\u65e0<br \/>\n\u54c8\u5e0c\u8868\u7684\u6700\u5927\u503c\uff0c\u67e5\u770b\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u8003<a href=\"http:\/\/www.howtocn.org\/nginx:optimizations#\u54c8\u5e0c\u8868_hash_tables\" rel=\"nofollow\">nginx\u90e8\u5206\u4f18\u5316\u9009\u9879<\/a>\u4e2d\u7684\u54c8\u5e0c\u8868\u3002<\/p>\n<h3><a name=\"NginxHTTP%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A8%A1%E5%9D%97-%E5%8F%98%E9%87%8F\"><\/a>\u53d8\u91cf<\/h3>\n<p>core module \u652f\u6301\u4e00\u4e9b\u5185\u7f6e\u7684\u53d8\u91cf\uff0c\u4e0eapache\u4f7f\u7528\u7684\u53d8\u91cf\u76f8\u4e00\u81f4\u3002<br \/>\n\u9996\u5148\uff0c\u4e00\u4e9b\u53d8\u91cf\u4ee3\u8868\u4e86\u5ba2\u6237\u7aef\u8bf7\u6c42\u5934\u90e8\u7684\u4e00\u4e9b\u5b57\u6bb5\uff0c\u5982\uff1a$http_user_agent, $http_cookie\u7b49\u7b49\u3002\u6ce8\u610f\uff0c\u7531\u4e8e\u8fd9\u4e9b\u53d8\u91cf\u4f1a\u5728\u8bf7\u6c42\u4e2d\u5b9a\u4e49\uff0c\u6240\u4ee5\u53ef\u80fd\u65e0\u6cd5\u4fdd\u8bc1\u4ed6\u4eec\u662f\u5b58\u5728\u7684\u6216\u8005\u8bf4\u53ef\u4ee5\u5b9a\u4e49\u5230\u4e00\u4e9b\u522b\u7684\u5730\u65b9\uff08\u4f8b\u5982\u9075\u5faa\u4e00\u5b9a\u7684\u89c4\u8303\uff09\u3002<br \/>\n\u9664\u6b64\u4e4b\u5916\uff0c\u4e0b\u5217\u662f\u4e00\u4e9b\u5176\u4ed6\u53d8\u91cf\uff1a<\/p>\n<p><strong>$arg_PARAMETER<\/strong><br \/>\n\u8fd9\u4e2a\u53d8\u91cf\u5305\u542b\u5728\u67e5\u8be2\u5b57\u7b26\u4e32\u65f6GET\u8bf7\u6c42PARAMETER\u7684\u503c\u3002<\/p>\n<p><strong>$args<\/strong><br \/>\n\u8fd9\u4e2a\u53d8\u91cf\u7b49\u4e8e\u8bf7\u6c42\u884c\u4e2d\u7684\u53c2\u6570\u3002<\/p>\n<p><strong>$binary_remote_addr<\/strong><br \/>\n\u4e8c\u8fdb\u5236\u7801\u5f62\u5f0f\u7684\u5ba2\u6237\u7aef\u5730\u5740\u3002<\/p>\n<p><strong>$body_bytes_sent<\/strong><br \/>\n\u5e94\u7b54\u5b9e\u4f53\u5927\u5c0f\uff0c\u5373\u4f7f\u8fde\u63a5\u5931\u8d25\u6216\u4e2d\u65ad\uff0c\u5b83\u4e5f\u975e\u5e38\u7cbe\u786e\u3002<\/p>\n<p><strong>$content_length<\/strong><br \/>\n\u8bf7\u6c42\u5934\u4e2d\u7684Content-length\u5b57\u6bb5\u3002<\/p>\n<p><strong>$content_type<\/strong><br \/>\n\u8bf7\u6c42\u5934\u4e2d\u7684Content-Type\u5b57\u6bb5\u3002<\/p>\n<p><strong>$cookie_COOKIE<\/strong><br \/>\ncookie COOKIE\u7684\u503c\u3002<\/p>\n<p><strong>$document_root<\/strong><br \/>\n\u5f53\u524d\u8bf7\u6c42\u5728root\u6307\u4ee4\u4e2d\u6307\u5b9a\u7684\u503c\u3002<\/p>\n<p><strong>$document_uri<\/strong><br \/>\n\u4e0e$uri\u76f8\u540c\u3002<\/p>\n<p><strong>$host<\/strong><br \/>\n\u8bf7\u6c42\u4e2d\u7684Host\u5b57\u6bb5\uff0c\u5982\u679c\u8bf7\u6c42\u4e2d\u7684Host\u5b57\u6bb5\u4e0d\u53ef\u7528\uff0c\u5219\u4e3a\u670d\u52a1\u5668\u5904\u7406\u8bf7\u6c42\u7684\u670d\u52a1\u5668\u540d\u79f0\u3002<br \/>\n\u5728\u4e0b\u5217\u60c5\u51b5\u4e0b\uff0c$host\u53d8\u91cf\u7684\u503c\u53ef\u80fd\u548c$http_host\u7684\u503c\u4e0d\u76f8\u540c\uff1a<\/p>\n<ol>\n<li>\u5f53\u8bf7\u6c42\u5934\u4e2d\u7684Host\u5b57\u6bb5\u672a\u6307\u5b9a\u6216\u8005\u4e3a\u7a7a\u503c\uff0c$host\u7b49\u4e8eserver_name\u6307\u4ee4\u6307\u5b9a\u7684\u503c\u3002<\/li>\n<li>\u5f53Host\u5b57\u6bb5\u5305\u542b\u7aef\u53e3\u53f7\u65f6\uff0c$host\u5e76\u4e0d\u5305\u542b\u7aef\u53e3\u53f7\uff0c$host\u7684\u503c\u57280.8.17\u540e\u603b\u662f\u5c0f\u5199\u3002<\/li>\n<\/ol>\n<p><strong>$hostname<\/strong><br \/>\n<a href=\"http:\/\/linux.die.net\/man\/2\/gethostname\" rel=\"nofollow\">gethostname<\/a>\u8fd4\u56de\u7684\u673a\u5668\u540d\u79f0\u3002<\/p>\n<p><strong>$is_args<\/strong><br \/>\n\u5982\u679c$args\u8bbe\u7f6e\uff0c\u503c\u4e3a\u201d?\u201d\uff0c\u5426\u5219\u4e3a\u201d\u201c\u3002<\/p>\n<p><strong>$limit_rate<\/strong><br \/>\n\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u9650\u5236\u8fde\u63a5\u901f\u7387\u3002<\/p>\n<p><strong>$nginx_version<\/strong><br \/>\n\u5f53\u524d\u8fd0\u884c\u7684nginx\u7248\u672c\u53f7\u3002<\/p>\n<p><strong>$query_string<\/strong><br \/>\n\u4e0e$args\u76f8\u540c\u3002<\/p>\n<p><strong>$remote_addr<\/strong><br \/>\n\u5ba2\u6237\u7aef\u7684IP\u5730\u5740\u3002<\/p>\n<p><strong>$remote_port<\/strong><br \/>\n\u5ba2\u6237\u7aef\u7684\u7aef\u53e3\u3002<\/p>\n<p><strong>$remote_user<\/strong><br \/>\n\u5df2\u7ecf\u7ecf\u8fc7<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:httpauthbasic\" rel=\"nofollow\">Auth Basic Module<\/a>\u9a8c\u8bc1\u7684\u7528\u6237\u540d\u3002<\/p>\n<p><strong>$request_filename<\/strong><br \/>\n\u5f53\u524d\u8fde\u63a5\u8bf7\u6c42\u7684\u6587\u4ef6\u8def\u5f84\uff0c\u7531root\u6216alias\u6307\u4ee4\u4e0eURI\u8bf7\u6c42\u751f\u6210\u3002<\/p>\n<p><strong>$request_body<\/strong><br \/>\n\u8fd9\u4e2a\u53d8\u91cf\uff080.7.58+\uff09\u5305\u542b\u8bf7\u6c42\u7684\u4e3b\u8981\u4fe1\u606f\u3002\u5728\u4f7f\u7528<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:httpproxy#proxy_pass\" rel=\"nofollow\">proxy_pass<\/a>\u6216<a href=\"http:\/\/www.howtocn.org\/nginx:nginx%E6%A8%A1%E5%9D%97%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%96%87%E7%89%88:standardhttpmodules:fastcgi#fastcgi_pass\" rel=\"nofollow\">fastcgi_pass<\/a>\u6307\u4ee4\u7684location\u4e2d\u6bd4\u8f83\u6709\u610f\u4e49\u3002<\/p>\n<p><strong>$request_body_file<\/strong><br \/>\n\u5ba2\u6237\u7aef\u8bf7\u6c42\u4e3b\u4f53\u4fe1\u606f\u7684\u4e34\u65f6\u6587\u4ef6\u540d\u3002<\/p>\n<p><strong>$request_completion<\/strong><br \/>\n\u5982\u679c\u8bf7\u6c42\u6210\u529f\uff0c\u503c\u4e3a\u201dOK\u201d\uff0c\u5982\u679c\u8bf7\u6c42\u672a\u5b8c\u6210\u6216\u8005\u8bf7\u6c42\u4e0d\u662f\u4e00\u4e2a\u8303\u56f4\u8bf7\u6c42\u7684\u6700\u540e\u4e00\u90e8\u5206\uff0c\u5219\u4e3a\u7a7a\u3002<\/p>\n<p><strong>$request_method<\/strong><br \/>\n\u8fd9\u4e2a\u53d8\u91cf\u662f\u5ba2\u6237\u7aef\u8bf7\u6c42\u7684\u52a8\u4f5c\uff0c\u901a\u5e38\u4e3aGET\u6216POST\u3002<br \/>\n\u5305\u62ec0.8.20\u53ca\u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0c\u8fd9\u4e2a\u53d8\u91cf\u603b\u4e3amain request\u4e2d\u7684\u52a8\u4f5c\uff0c\u5982\u679c\u5f53\u524d\u8bf7\u6c42\u662f\u4e00\u4e2a\u5b50\u8bf7\u6c42\uff0c\u5e76\u4e0d\u4f7f\u7528\u8fd9\u4e2a\u5f53\u524d\u8bf7\u6c42\u7684\u52a8\u4f5c\u3002<\/p>\n<p><strong>$request_uri<\/strong><br \/>\n\u8fd9\u4e2a\u53d8\u91cf\u7b49\u4e8e\u5305\u542b\u4e00\u4e9b\u5ba2\u6237\u7aef\u8bf7\u6c42\u53c2\u6570\u7684\u539f\u59cbURI\uff0c\u5b83\u65e0\u6cd5\u4fee\u6539\uff0c\u8bf7\u67e5\u770b$uri\u66f4\u6539\u6216\u91cd\u5199URI\uff0c\u4e0d\u5305\u542b\u4e3b\u673a\u540d\uff0c\u4f8b\u5982\uff1a\u201d\/foo\/bar.php?arg=baz\u201d\u3002<\/p>\n<p><strong>$scheme<\/strong><br \/>\nHTTP\u65b9\u6cd5\uff08\u5982http\uff0chttps\uff09\u3002\u6309\u9700\u4f7f\u7528\uff0c\u4f8b\uff1arewrite ^ $scheme:\/\/example.com$uri redirect;<\/p>\n<p><strong>$server_addr<\/strong><br \/>\n\u670d\u52a1\u5668\u5730\u5740\uff0c\u5728\u5b8c\u6210\u4e00\u6b21\u7cfb\u7edf\u8c03\u7528\u540e\u53ef\u4ee5\u786e\u5b9a\u8fd9\u4e2a\u503c\uff0c\u5982\u679c\u8981\u7ed5\u5f00\u7cfb\u7edf\u8c03\u7528\uff0c\u5219\u5fc5\u987b\u5728listen\u4e2d\u6307\u5b9a\u5730\u5740\u5e76\u4e14\u4f7f\u7528bind\u53c2\u6570\u3002<\/p>\n<p><strong>$server_name<\/strong><br \/>\n\u670d\u52a1\u5668\u540d\u79f0\u3002<\/p>\n<p><strong>$server_port<\/strong><br \/>\n\u8bf7\u6c42\u5230\u8fbe\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002<\/p>\n<p><strong>$server_protocol<\/strong><br \/>\n\u8bf7\u6c42\u4f7f\u7528\u7684\u534f\u8bae\uff0c\u901a\u5e38\u662fHTTP\/1.0\u6216HTTP\/1.1\u3002<\/p>\n<p><strong>$uri<\/strong><br \/>\n\u8bf7\u6c42\u4e2d\u7684\u5f53\u524dURI(\u4e0d\u5e26\u8bf7\u6c42\u53c2\u6570\uff0c\u53c2\u6570\u4f4d\u4e8e$args)\uff0c\u53ef\u4ee5\u4e0d\u540c\u4e8e\u6d4f\u89c8\u5668\u4f20\u9012\u7684$request_uri\u7684\u503c\uff0c\u5b83\u53ef\u4ee5\u901a\u8fc7\u5185\u90e8\u91cd\u5b9a\u5411\uff0c\u6216\u8005\u4f7f\u7528index\u6307\u4ee4\u8fdb\u884c\u4fee\u6539\uff0c$uri\u4e0d\u5305\u542b\u4e3b\u673a\u540d\uff0c\u5982\u201d\/foo\/bar.html\u201d\u3002<\/p>\n<\/div>\n<div id=\"labels-section\">\n<div id=\"default-labels-header\">\n<h2 id=\"labels-section-title\"><\/h2>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>aio \u8bed\u6cd5\uff1aaio [on|off|sendfile] \u9ed8\u8ba4\u503c\uff1aoff \u4f7f\u7528\u5b57\u6bb5\uff1ahttp, server, location \u8fd9\u4e2a\u6307\u4ee4\u5728Linux\u5185\u68382.6.1922\u4ee5\u4e0a\u7248\u672c\u53ef\u4ee5\u4f7f\u7528\uff0c\u5bf9\u4e8eLinux\u5185\u6838\uff0c\u8fd9\u4e2a\u6307\u4ee4\u9700\u8981\u914d\u5408directio\u6307\u4ee4\uff0c\u4f7f\u7528\u8fd9\u4e2a\u6307\u4ee4\u5c06\u81ea\u52a8\u5173\u95edsendfile\u652f\u6301\u3002location \/video<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[69],"tags":[122,192,123],"_links":{"self":[{"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/posts\/206"}],"collection":[{"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=206"}],"version-history":[{"count":1,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/posts\/206\/revisions"}],"predecessor-version":[{"id":207,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=\/wp\/v2\/posts\/206\/revisions\/207"}],"wp:attachment":[{"href":"https:\/\/www.codeeel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codeeel.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}