FAQ

Page Discussion Edit History

RuHttpCoreModule

(Redirected from NginxRuHttpCoreModule)

Contents

[edit] ngx_http_core_module

[edit] 袛懈褉械泻褌懈胁褘

  • [#alias alias]
  • [#client_body_in_file_only client_body_in_file_only]
  • [#client_body_buffer_size client_body_buffer_size]
  • [#client_body_temp_path client_body_temp_path]
  • [#client_body_timeout client_body_timeout]
  • [#client_header_buffer_size client_header_buffer_size]
  • [#client_header_timeout client_header_timeout]
  • [#client_max_body_size client_max_body_size]
  • [#default_type default_type]
  • [#error_page error_page]
  • [#internal internal]
  • [#keepalive_timeout keepalive_timeout]
  • [#large_client_header_buffers large_client_header_buffers]
  • [#limit_except limit_except]
  • [#limit_rate limit_rate]
  • [#listen listen]
  • [#location location]
  • [#msie_padding msie_padding]
  • [#msie_refresh msie_refresh]
  • [#optimize_server_names optimize_server_names]
  • [#port_in_redirect port_in_redirect]
  • [#recursive_error_pages recursive_error_pages]
  • [#root root]
  • [#satisfy_any satisfy_any]
  • [#send_timeout send_timeout]
  • [#sendfile sendfile]
  • [#server server]
  • [#server_name server_name]
  • [#server_names_hash_max_size server_names_hash_max_size]
  • [#server_names_hash_bucket_size server_names_hash_bucket_size]
  • [#tcp_nodelay tcp_nodelay]
  • [#tcp_nopush tcp_nopush]
  • [#types types]


[edit] 袙褋褌褉芯械薪薪褘械 锌械褉械屑械薪薪褘械

  • [#var_args $args]
  • [#var_content_length $content_length]
  • [#var_content_type $content_type]
  • [#var_document_root $document_root]
  • [#var_document_uri $document_uri]
  • [#var_host $host]
  • [#var_http_user_agent $http_user_agent]
  • [#var_http_cookie $http_cookie]
  • [#var_limit_rate $limit_rate]
  • [#var_request_method $request_method]
  • [#var_remote_addr $remote_addr]
  • [#var_remote_port $remote_port]
  • [#var_remote_user $remote_user]
  • [#var_request_filename $request_filename]
  • [#var_request_uri $request_uri]
  • [#var_query_string $query_string]
  • [#var_server_protocol $server_protocol]
  • [#var_server_addr $server_addr]
  • [#var_server_name $server_name]
  • [#var_server_port $server_port]
  • [#var_uri $uri]


Template:Anchor

[edit] alias

syntax: alias 锌褍褌褜 default: 薪械褌 context: location

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 蟹邪屑械薪褍 写谢褟 褍泻邪蟹邪薪薪芯谐芯 location. 袧邪锌褉懈屑械褉, 锌褉懈 褌邪泻芯泄 泻芯薪褎懈谐褍褉邪褑懈懈

location  /i/ {
: alias  /spool/w3/images/;
}

薪邪 蟹邪锌褉芯褋 "/i/top.gif" 斜褍写械褌 芯褌写邪薪 褎邪泄谢 "/spool/w3/images/top.gif".

袙 蟹薪邪褔械薪懈懈 锌褍褌懈 屑芯卸薪芯 懈褋锌芯谢褜蟹芯胁邪褌褜 锌械褉械屑械薪薪褘械. 袛懈褉械泻褌懈胁邪 alias 薪械 屑芯卸械褌 懈褋锌芯谢褜蟹芯胁邪褌褜褋褟 胁薪褍褌褉懈 location, 蟹邪写邪薪薪芯谐芯 褉械谐褍谢褟褉薪褘屑 胁褘褉邪卸械薪懈械屑.

Template:Anchor

[edit] client_body_in_file_only

syntax: client_body_in_file_only on|off

default: client_body_in_file_only off

context: http, server, location

袛懈褉械泻褌懈胁邪 芯锌褉械写械谢褟械褌, 褋芯褏褉邪薪褟褌褜 谢懈 胁褋褢 褌械谢芯 蟹邪锌褉芯褋邪 泻谢懈械薪褌邪 胁 褎邪泄谢. 袧械芯斜褏芯写懈屑芯 褍褔懈褌褘胁邪褌褜, 褔褌芯 锌褉懈 褉邪蟹褉械褕薪芯泄 写懈褉械泻褌懈胁械 褎邪泄谢 锌芯 芯泻芯薪褔邪薪懈懈 蟹邪锌褉芯褋邪 薪械 褍写邪谢褟械褌褋褟. 袛懈褉械泻褌懈胁褍 屑芯卸薪芯 懈褋锌芯谢褜蟹芯胁邪褌褜 写谢褟 芯褌谢邪写泻懈 懈 锌褉懈 懈褋锌芯谢褜蟹芯胁邪薪懈懈 屑械褌芯写邪 $r->request_body_file 屑芯写褍谢褟 ngx_http_perl_module.

Template:Anchor

[edit] client_body_buffer_size

syntax: client_body_buffer_size 褉邪蟹屑械褉 default: client_body_buffer_size 8k/16k context: http, server, location

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 褉邪蟹屑械褉 斜褍褎械褉邪 写谢褟 褔褌械薪懈褟 褌械谢邪 蟹邪锌褉芯褋邪 泻谢懈械薪褌邪. 袝褋谢懈 褌械谢芯 蟹邪锌褉芯褋邪 斜芯谢褜褕械 蟹邪写邪薪薪芯谐芯 斜褍褎械褉邪, 褌芯 胁褋褢 褌械谢芯 蟹邪锌褉芯褋邪 懈谢懈 褌芯谢褜泻芯 械谐芯 褔邪褋褌褜 蟹邪锌懈褋褘胁邪械褌褋褟 胁芯 胁褉械屑械薪薪褘泄 褎邪泄谢. 袩芯 褍屑芯谢褔邪薪懈褞 褉邪蟹屑械褉 芯写薪芯谐芯 斜褍褎械褉邪 褉邪胁械薪 写胁褍屑 褉邪蟹屑械褉邪屑 褋褌褉邪薪懈褑褘, 胁 蟹邪胁懈褋懈屑芯褋褌懈 芯褌 锌谢邪褌褎芯褉屑褘 褝褌芯 懈谢懈 8K, 懈谢懈 16K.

Template:Anchor

[edit] client_body_temp_path

syntax: client_body_temp_path 锌褍褌褜 [ 褍褉芯胁械薪褜1 [ 褍褉芯胁械薪褜2 [ 褍褉芯胁械薪褜3 ]

default: client_body_temp_path client_body_temp

context: http, server, location

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 懈屑褟 泻邪褌邪谢芯谐邪 写谢褟 褏褉邪薪械薪懈褟 胁褉械屑械薪薪褘褏 褎邪泄谢芯胁 褋 褌械谢芯屑 蟹邪锌褉芯褋邪 泻谢懈械薪褌邪. 袙 泻邪褌邪谢芯谐械 屑芯卸械褌 懈褋锌芯谢褜蟹芯胁邪褌褜褋褟 懈械褉邪褉褏懈褟 锌芯写泻邪褌邪谢芯谐芯胁 写芯 褌褉褢褏 褍褉芯胁薪械泄. 袧邪锌褉懈屑械褉, 锌褉懈 褌邪泻芯泄 泻芯薪褎懈谐褍褉邪褑懈懈

: client_body_temp_path  /spool/nginx/client_temp 1 2;

懈屑褟 胁褉械屑械薪薪芯谐芯 斜褍写械褌 褌邪泻芯谐芯 胁懈写邪:

: /spool/nginx/client_temp/7/45/00000123457

Template:Anchor

[edit] client_body_timeout

syntax: client_body_timeout 胁褉械屑褟 default: client_body_timeout 60 context: http, server, location

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 褌邪泄屑邪褍褌 锌褉懈 褔褌械薪懈懈 褌械谢邪 蟹邪锌褉芯褋邪 泻谢懈械薪褌邪. 孝邪泄屑邪褍褌 褍褋褌邪薪邪胁谢懈胁邪械褌褋褟 薪械 薪邪 胁褋褞 锌械褉械写邪褔褍 褌械谢邪 蟹邪锌褉芯褋邪, 邪 褌芯谢褜泻芯 屑械卸写褍 写胁褍屑褟 芯锌械褉邪褑懈褟屑懈 褔褌械薪懈褟. 袝褋谢懈 锌芯 懈褋褌械褔械薪懈懈 褝褌芯谐芯 胁褉械屑械薪懈 泻谢懈械薪褌 薪懈褔械谐芯 薪械 锌械褉械写邪褋褌, 褌芯 械屑褍 胁芯蟹胁褉邪褖邪械褌褋褟 芯褕懈斜泻邪 "Request time out" (408).


Template:Anchor

[edit] client_header_buffer_size

syntax: client_header_buffer_size 褉邪蟹屑械褉

default: client_header_buffer_size 1k

context: http, server

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 褉邪蟹屑械褉 斜褍褎械褉邪 写谢褟 褔褌械薪懈褟 蟹邪谐芯谢芯胁泻邪 蟹邪锌褉芯褋邪 泻谢懈械薪褌邪. 袛谢褟 锌芯写邪胁谢褟褞褖械谐芯 斜芯谢褜褕懈薪褋褌胁邪 蟹邪锌褉芯褋芯胁 胁锌芯谢薪械 写芯褋褌邪褌芯褔薪芯 斜褍褎械褉邪 褉邪蟹屑械褉芯屑 胁 1K. 袨写薪邪泻芯 械褋谢懈 胁 蟹邪锌褉芯褋械 械褋褌褜 斜芯谢褜褕懈械 cookies 懈谢懈 卸械 蟹邪锌褉芯褋 锌褉懈褕褢谢 芯褌 wap-泻谢懈械薪褌邪, 褌芯 芯薪 屑芯卸械褌 薪械 锌芯屑械褋褌懈褌褜褋褟 胁 1K. 袩芯褝褌芯屑褍, 械褋谢懈 褋褌褉芯泻邪 蟹邪锌褉芯褋邪 懈谢懈 褋褌褉芯泻邪 蟹邪谐芯谢芯胁泻邪 蟹邪锌褉芯褋邪 薪械 锌芯屑械褖邪械褌褋褟 锌芯谢薪芯褋褌褜褞 胁 褝褌芯褌 斜褍褎械褉, 褌芯 胁褘写械谢褟褞褌褋褟 斜芯谢褜褕懈械 斜褍褎械褉褘, 蟹邪写邪胁邪械屑褘械 写懈褉械泻褌懈胁芯泄 large_client_header_buffers.

Template:Anchor

[edit] client_header_timeout

syntax: client_header_timeout 胁褉械屑褟

default: client_header_timeout 60

context: http, server

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 褌邪泄屑邪褍褌 锌褉懈 褔褌械薪懈懈 蟹邪谐芯谢芯胁泻邪 蟹邪锌褉芯褋邪 泻谢懈械薪褌邪. 袝褋谢懈 锌芯 懈褋褌械褔械薪懈懈 褝褌芯谐芯 胁褉械屑械薪懈 泻谢懈械薪褌 薪械 锌械褉械写邪褋褌 锌芯谢薪芯褋褌褜褞 蟹邪谐芯谢芯胁芯泻 蟹邪锌褉芯褋邪, 褌芯 械屑褍 胁芯蟹胁褉邪褖邪械褌褋褟 芯褕懈斜泻邪 "Request time out" (408).


Template:Anchor

[edit] client_max_body_size

syntax: client_max_body_size 褉邪蟹屑械褉 default: client_max_body_size 1m context: http, server, location

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 屑邪泻褋懈屑邪谢褜薪芯 写芯锌褍褋褌懈屑褘泄 褉邪蟹屑械褉 褌械谢邪 蟹邪锌褉芯褋邪 泻谢懈械薪褌邪, 褍泻邪蟹褘胁邪械屑褘泄 胁 褋褌褉芯泻械 "Content-Length" 胁 蟹邪谐芯谢芯胁泻械 蟹邪锌褉芯褋邪. 袝褋谢懈 褉邪蟹屑械褉 斜芯谢褜褕械 蟹邪写邪薪薪芯谐芯, 褌芯 泻谢懈械薪褌褍 胁芯蟹胁褉邪褖邪械褌褋褟 芯褕懈斜泻邪 "Request Entity Too Large" (413). 小谢械写褍械褌 懈屑械褌褜 胁 胁懈写褍, 褔褌芯 斜褉邪褍蟹械褉褘 薪械 褍屑械褞褌 泻芯褉褉械泻褌薪芯 锌芯泻邪蟹褘胁邪褌褜 褝褌褍 芯褕懈斜泻褍.


Template:Anchor

[edit] default_type

syntax: default_type MIME-褌懈锌 default: default_type text/plain context: http, server, location

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 MIME-褌懈锌 芯褌胁械褌芯胁 锌芯 褍屑芯谢褔邪薪懈褞.

Template:Anchor

[edit] error_page

syntax: error_page 泻芯写 [泻芯写 ...] [=|=芯褌胁械褌] uri

default: 薪械褌

context: http, server, location, if 胁 location

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 URI, 泻芯褌芯褉褘泄 斜褍写械褌 锌芯泻邪蟹褘胁邪褌褜褋褟 写谢褟 褍泻邪蟹邪薪薪褘褏 芯褕懈斜芯泻. 袙 URI 屑芯卸薪芯 懈褋锌芯谢褜蟹芯胁邪褌褜 锌械褉械屑械薪薪褘械.

袩褉懈屑械褉 懈褋锌芯谢褜蟹芯胁邪薪懈褟:

: error_page   404          /404.html;
: error_page   502 503 504  /50x.html;
: error_page   403          http://example.com/forbidden.html;

袣褉芯屑械 褌芯谐芯, 屑芯卸薪芯 锌芯屑械薪褟褌褜 泻芯写 芯褌胁械褌邪 薪邪 写褉褍谐芯泄, 薪邪锌褉懈屑械褉:

: error_page   404  =200  /empty.gif;

袝褋谢懈 芯褕懈斜芯褔薪褘泄 芯褌胁械褌 芯斜褉邪斜邪褌褘胁邪械褌褋褟 锌褉芯泻褋懈褉芯胁邪薪薪褘屑 褋械褉胁械褉芯屑 懈谢懈 FastCGI-褋械褉胁械褉芯屑 懈 褝褌芯褌 褋械褉胁械褉 屑芯卸械褌 胁械褉薪褍褌褜 褉邪蟹薪褘械 泻芯写褘 芯褌胁械褌芯胁, 薪邪锌褉懈屑械褉, 200, 302, 401 懈谢懈 404, 褌芯 屑芯卸薪芯 胁褘写邪胁邪褌褜 胁芯蟹胁褉邪褖邪械屑褘泄 泻芯写:

: error_page   404  =  /404.php;


Template:Anchor

[edit] internal

syntax: internal

default: 薪械褌

context: location

袛懈褉械泻褌懈胁邪 褍泻邪蟹褘胁邪械褌, 褔褌芯 写邪薪薪褘泄 location 屑芯卸械褌 懈褋锌芯谢褜蟹芯胁邪褌褜褋褟 褌芯谢褜泻芯 写谢褟 胁薪褍褌褉械薪薪懈褏 蟹邪锌褉芯褋芯胁. 袛谢褟 胁薪械褕薪懈褏 蟹邪锌褉芯褋芯胁 斜褍写械褌 胁芯蟹胁褉邪褖邪褌褜褋褟 芯褕懈斜泻邪 "Not found" (404). 袙薪褍褌褉械薪薪懈屑懈 蟹邪锌褉芯褋邪屑懈 褟胁谢褟褞褌褋褟

  • 蟹邪锌褉芯褋褘, 锌械褉械薪邪锌褉邪胁谢械薪薪褘械 写懈褉械泻褌懈胁芯泄 error_page;
  • 锌芯写蟹邪锌褉芯褋褘, 褎芯褉屑懈褉褍械屑褘械 泻芯屑邪薪写芯泄 include virtual 屑芯写褍谢褟 ngx_http_ssi_module;
  • 蟹邪锌褉芯褋褘, 懈蟹屑械薪褢薪薪褘械 写懈褉械泻褌懈胁芯泄 rewrite 屑芯写褍谢褟 ngx_http_rewrite_module.

袩褉懈屑械褉 懈褋锌芯谢褜蟹芯胁邪薪懈褟:

: error_page   404   /404.html;

: location  /404.html {
: internal;
: }

Template:Anchor

[edit] keepalive_timeout

syntax: keepalive_timeout 胁褉械屑褟 [胁褉械屑褟]

default: keepalive_timeout 75

context: http, server, location

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 褌邪泄屑邪褍褌, 胁 褌械褔械薪懈械 泻芯褌芯褉芯谐芯 keep-alive 褋芯械写懈薪械薪懈械 褋 泻谢懈械薪褌芯屑 薪械 斜褍写械褌 蟹邪泻褉褘褌芯 褋芯 褋褌芯褉芯薪褘 褋械褉胁械褉邪. 袙褌芯褉芯泄 锌邪褉邪屑械褌褉 蟹邪写邪褢褌 蟹薪邪褔械薪懈械 胁 褋褌褉芯泻械 "Keep-Alive: timeout=胁褉械屑褟" 胁 蟹邪谐芯谢芯胁泻械 芯褌胁械褌邪. 袩邪褉邪屑械褌褉褘 屑芯谐褍褌 芯褌谢懈褔邪褌褜褋褟 写褉褍谐 芯褌 写褉褍谐邪. 小褌褉芯泻褍 "Keep-Alive: timeout=胁褉械屑褟" 锌芯薪懈屑邪褞褌 Mozilla 懈 Konqueror. MSIE 褋邪屑 蟹邪泻褉褘胁邪械褌 keep-alive 褋芯械写懈薪械薪懈械 锌褉懈屑械褉薪芯 褔械褉械蟹 60 褋械泻褍薪写.

Template:Anchor

[edit] large_client_header_buffers

syntax: large_client_header_buffers 褔懈褋谢芯 褉邪蟹屑械褉

default: large_client_header_buffers 4 4k/8k

context: http, server

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 屑邪泻褋懈屑邪谢褜薪芯械 褔懈褋谢芯 懈 褉邪蟹屑械褉 斜褍褎械褉芯胁 写谢褟 褔褌械薪懈褟 斜芯谢褜褕芯谐芯 蟹邪谐芯谢芯胁泻邪 蟹邪锌褉芯褋邪 泻谢懈械薪褌邪. 小褌褉芯泻邪 蟹邪锌褉芯褋邪 写芯谢卸薪邪 斜褘褌褜 薪械 斜芯谢褜褕械 褉邪蟹屑械褉邪 芯写薪芯谐芯 斜褍褎械褉邪, 懈薪邪褔械 泻谢懈械薪褌褍 胁芯蟹胁褉邪褖邪械褌褋褟 芯褕懈斜泻邪 "Request URI too large" (414). 袛谢懈薪薪邪褟 褋褌褉芯泻邪 蟹邪谐芯谢芯胁泻邪 蟹邪锌褉芯褋邪 褌邪泻卸械 写芯谢卸薪邪 斜褘褌褜 薪械 斜芯谢褜褕械 褉邪蟹屑械褉邪 芯写薪芯谐芯 斜褍褎械褉邪, 懈薪邪褔械 泻谢懈械薪褌褍 胁芯蟹胁褉邪褖邪械褌褋褟 芯褕懈斜泻邪 "Bad request" (400). 袘褍褎械褉褘 胁褘写械谢褟褞褌褋褟 褌芯谢褜泻芯 锌芯 屑械褉械 薪械芯斜褏芯写懈屑芯褋褌懈. 袩芯 褍屑芯谢褔邪薪懈褞 褉邪蟹屑械褉 芯写薪芯谐芯 斜褍褎械褉邪 褉邪胁械薪 褉邪蟹屑械褉褍 褋褌褉邪薪懈褑褘, 胁 蟹邪胁懈褋懈屑芯褋褌懈 芯褌 锌谢邪褌褎芯褉屑褘 褝褌芯 懈谢懈 4K, 懈谢懈 8K. 袝褋谢懈 锌芯 芯泻芯薪褔邪薪懈懈 芯斜褉邪斜芯褌泻懈 蟹邪锌褉芯褋邪 褋芯械写懈薪械薪懈械 锌械褉械褏芯写懈褌 胁 褋芯褋褌芯褟薪懈械 keep-alive, 褌芯 褝褌懈 斜褍褎械褉褘 芯褋胁芯斜芯卸写邪褞褌褋褟.

Template:Anchor

[edit] limit_except

syntax: limit_except 屑械褌芯写褘 { ... }

default: 薪械褌

context: location

袛懈褉械泻褌懈胁邪 芯谐褉邪薪懈褔懈胁邪械褌 HTTP-屑械褌芯写褘, 写芯褋褌褍锌薪褘械 胁薪褍褌褉懈 location. 袛谢褟 芯谐褉邪薪懈褔械薪懈褟 屑芯谐褍褌 懈褋锌芯谢褜蟹芯胁邪褌褜褋褟 写懈褉械泻褌懈胁褘 屑芯写褍谢械泄 ngx_http_access_module 懈 ngx_http_auth_basic_module:

: limit_except  GET {
: allow  192.168.1.0/32;
: deny   all;
: }

Template:Anchor

[edit] limit_rate

syntax: limit_rate 褋泻芯褉芯褋褌褜

default: 薪械褌

context: http, server, location, if 胁 location

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 褋泻芯褉芯褋褌褜 锌械褉械写邪褔懈 芯褌胁械褌邪 泻谢懈械薪褌褍. 小泻芯褉芯褋褌褜 蟹邪写邪褢褌褋褟 胁 斜邪泄褌邪褏 胁 褋械泻褍薪写褍. 袨谐褉邪薪懈褔械薪懈械 褉邪斜芯褌邪械褌 褌芯谢褜泻芯 写谢褟 芯写薪芯谐芯 褋芯械写懈薪械薪懈褟, 褌芯 械褋褌褜, 械褋谢懈 泻谢懈械薪褌 芯褌泻褉芯械褌 2 褋芯械写懈薪械薪懈褟, 褌芯 褋褍屑屑邪褉薪邪褟 褋泻芯褉芯褋褌褜 斜褍写械褌 胁 2 褉邪蟹邪 胁褘褕械 芯谐褉邪薪懈褔械薪薪芯泄.

袝褋谢懈 薪械芯斜褏芯写懈屑芯 芯谐褉邪薪懈褔懈褌褜 褋泻芯褉芯褋褌褜 写谢褟 褔邪褋褌懈 泻谢懈械薪褌芯胁 薪邪 褍褉芯胁薪械 褋械褉胁械褉邪, 褌芯 写懈褉械泻褌懈胁邪 limit_rate 写谢褟 褝褌芯谐芯 薪械 锌芯写褏芯写懈褌. 袙屑械褋褌芯 褝褌芯谐芯 褋谢械写褍械褌 蟹邪写邪褌褜 薪褍卸薪褍褞 褋泻芯褉芯褋褌褜 锌械褉械屑械薪薪芯泄 $limit_rate:

: server {

: if ($slow) {
: set $limit_rate  4k;
: }

: ...
: }

Template:Anchor

[edit] listen

syntax: listen 邪写褉械褋:锌芯褉褌 [default [backlog=褔懈褋谢芯 | rcvbuf=褉邪蟹屑械褉 | sndbuf=褉邪蟹屑械褉 | accept_filter=褎懈谢褜褌褉 | deferred | bind ] default: listen 80

context: server

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 邪写褉械褋 懈 锌芯褉褌, 薪邪 泻芯褌芯褉褘褏 褋械褉胁械褉 锌褉懈薪懈屑邪械褌 蟹邪锌褉芯褋褘. 袦芯卸薪芯 褍泻邪蟹邪褌褜 褌芯谢褜泻芯 邪写褉械褋 懈谢懈 褌芯谢褜泻芯 锌芯褉褌, 泻褉芯屑械 褌芯谐芯, 邪写褉械褋 屑芯卸械褌 斜褘褌褜 懈屑械薪械屑 褋械褉胁械褉邪, 薪邪锌褉懈屑械褉:

: listen  127.0.0.1:8000;
: listen  127.0.0.1;
: listen  8000;
: listen  *:8000;
: listen  localhost:8000;

袝褋谢懈 褍泻邪蟹邪薪 褌芯谢褜泻芯 邪写褉械褋, 褌芯 懈褋锌芯谢褜蟹褍械褌褋褟 锌芯褉褌 80.

袝褋谢懈 褍 写懈褉械泻褌懈胁褘 械褋褌褜 锌邪褉邪屑械褌褉 default, 褌芯 褋械褉胁械褉, 胁 泻芯褌芯褉芯屑 芯锌懈褋邪薪邪 褝褌邪 写懈褉械泻褌懈胁邪, 斜褍写械褌 褋械褉胁械褉芯屑 锌芯 褍屑芯谢褔邪薪懈褞 写谢褟 褍泻邪蟹邪薪薪芯泄 锌邪褉褘 邪写褉械褋:锌芯褉褌. 袝褋谢懈 卸械 写懈褉械泻褌懈胁 褋 锌邪褉邪屑械褌褉芯屑 default 薪械褌, 褌芯 褋械褉胁械褉芯屑 锌芯 褍屑芯谢褔邪薪懈褞 斜褍写械褌 锌械褉胁褘泄 褋械褉胁械褉, 胁 泻芯褌芯褉芯屑 芯锌懈褋邪薪邪 锌邪褉邪 邪写褉械褋:锌芯褉褌.

袙 写懈褉械泻褌懈胁械 listen 褋 锌邪褉邪屑械褌褉芯屑 default 屑芯卸薪芯 褌邪泻卸械 褍泻邪蟹邪褌褜 薪械褋泻芯谢褜泻芯 锌邪褉邪屑械褌褉芯胁, 褋锌械褑懈褎懈褔薪褘褏 写谢褟 褋懈褋褌械屑薪褘褏 胁褘蟹芯胁芯胁 listen(2) 懈 bind(2).

  • backlog=褔懈褋谢芯 鈥 蟹邪写邪褢褌 锌邪褉邪屑械褌褉 backlog 胁 胁褘蟹芯胁械 listen(2). 袩芯 褍屑芯谢褔邪薪懈褞 backlog 褉邪胁械薪 -1.
  • rcvbuf=褉邪蟹屑械褉 鈥 蟹邪写邪褢褌 锌邪褉邪屑械褌褉 SO_RCVBUF 写谢褟 褋谢褍褕邪褞褖械谐芯 褋芯泻械褌邪.
  • sndbuf=褉邪蟹屑械褉 鈥 蟹邪写邪褢褌 锌邪褉邪屑械褌褉 SO_SNDBUF 写谢褟 褋谢褍褕邪褞褖械谐芯 褋芯泻械褌邪.
  • accept_filter=褎懈谢褜褌褉 鈥 蟹邪写邪褢褌 薪邪蟹胁邪薪懈械 accept-褎懈谢褜褌褉邪. 袪邪斜芯褌邪械褌 褌芯谢褜泻芯 薪邪 FreeBSD, 屑芯卸薪芯 懈褋锌芯谢褜蟹芯胁邪褌褜 写胁邪 褎懈谢褜褌褉邪 鈥 dataready 懈 httpready. 袩芯 褋懈谐薪邪谢褍 -HUP accept-褎懈谢褜褌褉 屑芯卸薪芯 屑械薪褟褌褜 褌芯谢褜泻芯 胁 褋邪屑褘褏 锌芯褋谢械写薪懈褏 胁械褉褋懈褟褏 FreeBSD: 6.0, 5.4-STABLE 懈 4.11-STABLE.
  • deferred 鈥 褍泻邪蟹褘胁邪械褌 懈褋锌芯谢褜蟹芯胁邪褌褜 芯褌谢芯卸械薪薪褘泄 accept(2) 薪邪 Linux 褋 锌芯屑芯褖褜褞 芯锌褑懈懈 TCP_DEFER_ACCEPT.
  • bind 鈥 褍泻邪蟹褘胁邪械褌, 褔褌芯 写谢褟 写邪薪薪芯泄 锌邪褉褘 邪写褉械褋:锌芯褉褌 薪褍卸薪芯 写械谢邪褌褜 bind(2) 芯褌写械谢褜薪芯. 袛械谢芯 胁 褌芯屑, 褔褌芯 械褋谢懈 芯锌懈褋邪薪褘 薪械褋泻芯谢褜泻芯 写懈褉械泻褌懈胁 listen 褋 芯写懈薪邪泻芯胁褘屑 锌芯褉褌芯屑, 薪芯 褉邪蟹薪褘屑懈 邪写褉械褋邪屑懈 懈 芯写薪邪 懈蟹 写懈褉械泻褌懈胁 listen 褋谢褍褕邪械褌 薪邪 胁褋械褏 邪写褉械褋邪褏 写谢褟 写邪薪薪芯谐芯 锌芯褉褌邪 (*:锌芯褉褌), 褌芯 nginx 褋写械谢邪械褌 bind(2) 褌芯谢褜泻芯 薪邪 *:锌芯褉褌. 袧械芯斜褏芯写懈屑芯 褍褔懈褌褘胁邪褌褜, 褔褌芯 胁 褝褌芯屑 褋谢褍褔邪械 写谢褟 芯锌褉械写械谢械薪懈褟 邪写褉械褋邪, 薪邪 泻芯褌芯褉芯泄 锌褉懈褕谢芯 褋芯械写懈薪械薪懈械, 写械谢邪械褌褋褟 褋懈褋褌械屑薪褘泄 胁褘蟹芯胁 getsockname(). 袝褋谢懈 卸械 懈褋锌芯谢褜蟹褍褞褌褋褟 锌邪褉邪屑械褌褉褘 backlog, rcvbuf, sndbuf, accept_filter 懈谢懈 deferred, 褌芯 写谢褟 写邪薪薪芯泄 锌邪褉褘 邪写褉械褋:锌芯褉褌 bind(2) 胁褋械谐写邪 写械谢邪械褌褋褟 芯褌写械谢褜薪芯.

袩褉懈屑械褉 懈褋锌芯谢褜蟹芯胁邪薪懈褟 锌邪褉邪屑械褌褉芯胁:

: listen  127.0.0.1 default accept_filter=dataready backlog=1024;

Template:Anchor

[edit] location

syntax: location [=|~|~*|^~] /uri/ { ... }

default: 薪械褌

context: server

袛懈褉械泻褌懈胁邪 褍褋褌邪薪邪胁谢懈胁邪械褌 泻芯薪褎懈谐褍褉邪褑懈褞 胁 蟹邪胁懈褋懈屑芯褋褌懈 芯褌 URI 蟹邪锌褉芯褋邪. location 屑芯卸薪芯 蟹邪写邪褌褜 芯斜褘褔薪芯泄 褋褌褉芯泻芯泄 懈谢懈 褉械谐褍谢褟褉薪褘屑 胁褘褉邪卸械薪懈械屑. 袪械谐褍谢褟褉薪褘械 胁褘褉邪卸械薪懈褟 蟹邪写邪褞褌褋褟 锌褉械褎懈泻褋芯屑 "~*" 鈥 斜械蟹 褍褔褢褌邪 褉械谐懈褋褌褉邪 褋懈屑胁芯谢芯胁, 懈 "~" 鈥 褋 褍褔褢褌芯屑. 袛谢褟 芯锌褉械写械谢械薪懈褟 褋芯芯褌胁械褌褋褌胁懈褟 location'邪 懈 蟹邪锌褉芯褋邪 褋薪邪褔邪谢邪 锌褉芯胁械褉褟褞褌褋褟 location'褘, 蟹邪写邪薪薪褘械 芯斜褘褔薪褘屑懈 褋褌褉芯泻邪屑懈. 小褉械写懈 薪懈褏 懈褖械褌褋褟 屑邪泻褋懈屑邪谢褜薪芯械 褋芯胁锌邪写械薪懈械. 孝邪泻 泻邪泻 褋褌褉芯泻懈 谢械泻褋懈褔械褋泻懈 芯褌褋芯褉褌懈褉芯胁邪薪褘, 褌芯 锌芯懈褋泻 锌褉械泻褉邪褖邪械褌褋褟, 泻邪泻 褌芯谢褜泻芯 URI 褋褌邪薪芯胁懈褌褋褟 谢械泻褋懈褔械褋泻懈 斜芯谢褜褕械 location'邪. 袣芯薪褎懈谐褍褉邪褑懈褟 屑邪泻褋懈屑邪谢褜薪芯 褋芯胁锌邪胁褕械谐芯 location'邪 蟹邪锌芯屑懈薪邪械褌褋褟. 袟邪褌械屑 锌褉芯胁械褉褟褞褌褋褟 褉械谐褍谢褟褉薪褘械 胁褘褉邪卸械薪懈褟. 袙 芯褌谢懈褔懈械 芯褌 芯斜褘褔薪褘褏 褋褌褉芯泻, 芯薪懈 薪械 褋芯褉褌懈褉褍褞褌褋褟, 邪 锌褉芯胁械褉褟褞褌褋褟 胁 锌芯褉褟写泻械 懈褏 褋谢械写芯胁邪薪懈褟 胁 泻芯薪褎懈谐褍褉邪褑懈芯薪薪芯屑 褎邪泄谢械. 袠, 泻褉芯屑械 褌芯谐芯, 锌芯懈褋泻 锌褉械泻褉邪褖邪械褌褋褟 褍卸械 锌芯褋谢械 锌械褉胁芯谐芯 褋芯胁锌邪写械薪懈褟.

袝褋谢懈 薪褍卸薪芯 蟹邪锌褉械褌懈褌褜 锌褉芯胁械褉泻褍 褉械谐褍谢褟褉薪褘褏 胁褘褉邪卸械薪懈泄 锌芯褋谢械 锌褉芯胁械褉泻懈 芯斜褘褔薪褘褏 褋褌褉芯泻, 褌芯 褝褌芯 屑芯卸薪芯 褋写械谢邪褌褜 褋 锌芯屑芯褖褜褞 锌褉械褎懈泻褋邪 "^~". 袝褋谢懈 褍 屑邪泻褋懈屑邪谢褜薪芯 褋芯胁锌邪胁褕械谐芯 location'邪 械褋褌褜 褝褌芯褌 锌褉械褎懈泻褋, 褌芯 褉械谐褍谢褟褉薪褘械 胁褘褉邪卸械薪懈褟 薪械 锌褉芯胁械褉褟褞褌褋褟.

袣褉芯屑械 褌芯谐芯, 褋 锌芯屑芯褖褜褞 锌褉械褎懈泻褋邪 "=" 屑芯卸薪芯 蟹邪写邪褌褜 褌芯褔薪芯械 褋芯胁锌邪写械薪懈械 URI 懈 location. 袩褉懈 褋芯胁锌邪写械薪懈懈 锌芯懈褋泻 褋褉邪蟹褍 卸械 锌褉械泻褉邪褖邪械褌褋褟, 褌邪泻 泻邪泻 写邪谢褜褕械 懈褋泻邪褌褜 薪械 懈屑械械褌 褋屑褘褋谢邪. 袧邪锌褉懈屑械褉, 械褋谢懈 蟹邪锌褉芯褋 "/" 芯褔械薪褜 褔邪褋褌褘泄, 褌芯 褍泻邪蟹邪胁 "location = /", 屑芯卸薪芯 褍褋泻芯褉懈褌褜 芯斜褉邪斜芯褌泻褍 褝褌芯谐芯 蟹邪锌褉芯褋邪, 褌邪泻 泻邪泻 锌芯懈褋泻 location 锌褉械泻褉邪褌懈褌褋褟 锌芯褋谢械 锌械褉胁芯谐芯 卸械 褋褉邪胁薪械薪懈褟.

袩褉芯懈谢谢褞褋褌褉懈褉褍械屑 胁褘褕械褋泻邪蟹邪薪薪芯械 锌褉懈屑械褉芯屑:

: location  = / {
: [ 泻芯薪褎懈谐褍褉邪褑懈褟 A ] 
: }

: location  / {
: [ 泻芯薪褎懈谐褍褉邪褑懈褟 B ] 
: }

: location ^~ /images/ {
: [ 泻芯薪褎懈谐褍褉邪褑懈褟 C ] 
: }

: location ~* \.(gif|jpg|jpeg)$ {
: [ 泻芯薪褎懈谐褍褉邪褑懈褟 D ] 
: }

袛谢褟 蟹邪锌褉芯褋邪 "/" 斜褍写械褌 胁褘斜褉邪薪邪 泻芯薪褎懈谐褍褉邪褑懈褟 A, 写谢褟 蟹邪锌褉芯褋邪 "/documents/document.html" 鈥 泻芯薪褎懈谐褍褉邪褑懈褟 B, 写谢褟 蟹邪锌褉芯褋邪 "/images/1.gif" 鈥 泻芯薪褎懈谐褍褉邪褑懈褟 C, 写谢褟 蟹邪锌褉芯褋邪 "/documents/1.jpg" 鈥 泻芯薪褎懈谐褍褉邪褑懈褟 D.


Template:Anchor

[edit] msie_padding

syntax: msie_padding [on|off]

default: msie_padding on

context: http, server, location

袛懈褉械泻褌懈胁邪 褉邪蟹褉械褕邪械褌 懈谢懈 蟹邪锌褉械褖邪械褌 写芯斜邪胁谢褟褌褜 胁 芯褌胁械褌褘 写谢褟 MSIE 褋芯 褋褌邪褌褍褋芯屑 斜芯谢褜褕械 400 泻芯屑屑械薪褌邪褉懈泄 写谢褟 褍胁械谢懈褔械薪懈褟 褉邪蟹屑械褉邪 芯褌胁械褌邪 写芯 512 斜邪泄褌.


Template:Anchor

[edit] msie_refresh

syntax: msie_refresh [on|off]

default: msie_refresh off

context: http, server, location

袛懈褉械泻褌懈胁邪 褉邪蟹褉械褕邪械褌 懈谢懈 蟹邪锌褉械褖邪械褌 胁褘写邪胁邪褌褜 写谢褟 MSIE refresh'褘 胁屑械褋褌芯 褉械写懈褉械泻褌芯胁.


Template:Anchor

[edit] optimize_server_names

syntax: optimize_server_names [on|off]

default: optimize_server_names on

context: http, server

袛懈褉械泻褌懈胁邪 褉邪蟹褉械褕邪械褌 懈谢懈 蟹邪锌褉械褖邪械褌 芯锌褌懈屑懈蟹懈褉芯胁邪褌褜 锌褉芯胁械褉泻褍 懈屑械薪懈 褏芯褋褌邪 胁 name-based 胁懈褉褌褍邪谢褜薪褘褏 褋械褉胁械褉邪褏. 袩褉芯胁械褉泻邪 胁 褔邪褋褌薪芯褋褌懈 胁谢懈褟械褌 薪邪 懈屑褟 褏芯褋褌邪, 懈褋锌芯谢褜蟹褍械屑芯谐芯 胁 褉械写懈褉械泻褌邪褏. 袝褋谢懈 芯锌褌懈屑懈蟹邪褑懈褟 褉邪蟹褉械褕械薪邪 懈 胁褋械 name-based 褋械褉胁械褉邪, 褋谢褍褕邪褞褖懈械 薪邪 芯写薪芯泄 锌邪褉械 邪写褉械褋:锌芯褉褌, 懈屑械褞褌 芯写懈薪邪泻芯胁褍褞 泻芯薪褎懈谐褍褉邪褑懈褞, 褌芯 胁芯 胁褉械屑褟 懈褋锌芯谢薪械薪懈褟 蟹邪锌褉芯褋邪 懈屑械薪邪 薪械 锌褉芯胁械褉褟褞褌褋褟 懈 胁 褉械写懈褉械泻褌邪褏 懈褋锌芯谢褜蟹褍械褌褋褟 锌械褉胁芯械 懈屑褟 褋械褉胁械褉邪. 袝褋谢懈 胁 褉械写懈褉械泻褌械 薪褍卸薪芯 懈褋锌芯谢褜蟹芯胁邪褌褜 懈屑褟 褏芯褋褌邪, 锌械褉械写邪薪薪芯械 泻谢懈械薪褌芯屑, 褌芯 芯锌褌懈屑懈蟹邪褑懈褞 薪褍卸薪芯 胁褘泻谢褞褔懈褌褜.

Template:Anchor

[edit] port_in_redirect

syntax: port_in_redirect [on|off]

default: port_in_redirect on

context: http, server, location

袛懈褉械泻褌懈胁邪 褉邪蟹褉械褕邪械褌 懈谢懈 蟹邪锌褉械褖邪械褌 褍泻邪蟹褘胁邪褌褜 锌芯褉褌 胁 褉械写懈褉械泻褌邪褏, 胁褘写邪胁邪械屑褘褏 nginx'芯屑.


Template:Anchor

[edit] recursive_error_pages

syntax: recursive_error_pages [on|off]

default: recursive_error_pages off

context: http, server, location

袛懈褉械泻褌懈胁邪 褉邪蟹褉械褕邪械褌 懈谢懈 蟹邪锌褉械褖邪械褌 写械谢邪褌褜 薪械褋泻芯谢褜泻芯 锌械褉械薪邪锌褉邪胁谢械薪懈泄 褔械褉械蟹 写懈褉械泻褌懈胁褍 error_page.

Template:Anchor

[edit] root

syntax: root 锌褍褌褜

default: root html

context: http, server, location, if 胁 location

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 泻芯褉薪械胁芯泄 泻邪褌邪谢芯谐 写谢褟 蟹邪锌褉芯褋芯胁. 袧邪锌褉懈屑械褉, 锌褉懈 褌邪泻芯泄 泻芯薪褎懈谐褍褉邪褑懈懈

: location  /i/ {
: root  /spool/w3;
: }

薪邪 蟹邪锌褉芯褋 "/i/top.gif" 斜褍写械褌 芯褌写邪薪 褎邪泄谢 "/spool/w3/i/top.gif". 袙 蟹薪邪褔械薪懈懈 锌褍褌懈 屑芯卸薪芯 懈褋锌芯谢褜蟹芯胁邪褌褜 锌械褉械屑械薪薪褘械.


Template:Anchor

[edit] satisfy_any

syntax: satisfy_any on|off

default: satisfy_any off

context: location

袛懈褉械泻褌懈胁邪 褉邪蟹褉械褕邪械褌 写芯褋褌褍锌 锌褉懈 褏芯褌褟 斜褘 芯写薪芯泄 褍褋锌械褕薪芯泄 锌褉芯胁械褉泻械, 胁褘锌芯谢薪械薪薪芯泄 屑芯写褍谢褟屑懈 ngx_http_access_module 懈谢懈 ngx_http_auth_basic_module:

: location / {
: satisfy_any  on;

: allow  192.168.1.0/32;
: deny   all;

: auth_basic            "closed site";
: auth_basic_user_file  conf/htpasswd;
: }

Template:Anchor

[edit] send_timeout

syntax: send_timeout 胁褉械屑褟

default: send_timeout 60

context: http, server, location

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 褌邪泄屑邪褍褌 锌褉懈 锌械褉械写邪褔械 芯褌胁械褌邪 泻谢懈械薪褌褍. 孝邪泄屑邪褍褌 褍褋褌邪薪邪胁谢懈胁邪械褌褋褟 薪械 薪邪 胁褋褞 锌械褉械写邪褔褍 芯褌胁械褌邪, 邪 褌芯谢褜泻芯 屑械卸写褍 写胁褍屑褟 芯锌械褉邪褑懈褟屑懈 褔褌械薪懈褟. 袝褋谢懈 锌芯 懈褋褌械褔械薪懈懈 褝褌芯谐芯 胁褉械屑械薪懈 泻谢懈械薪褌 薪懈褔械谐芯 薪械 锌褉懈屑械褌, 褌芯 nginx 蟹邪泻褉褘胁邪械褌 褋芯械写懈薪械薪懈械.

Template:Anchor

[edit] sendfile

syntax: sendfile [on|off]

default: sendfile off

context: http, server, location

袛懈褉械泻褌懈胁邪 褉邪蟹褉械褕邪械褌 懈谢懈 蟹邪锌褉械褖邪械褌 懈褋锌芯谢褜蟹芯胁邪褌褜 sendfile().

Template:Anchor

[edit] server

syntax: server { ... }

default: 薪械褌

context: http

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 泻芯薪褎懈谐褍褉邪褑懈褞 写谢褟 胁懈褉褌褍邪谢褜薪芯谐芯 褋械褉胁械褉邪. 效褢褌泻芯谐芯 褉邪蟹写械谢械薪懈褟 胁懈褉褌褍邪谢褜薪褘褏 褋械褉胁械褉芯胁 ip-based (薪邪 芯褋薪芯胁邪薪懈懈 ip-邪写褉械褋邪) 懈 name-based (薪邪 芯褋薪芯胁邪薪懈懈 懈屑械薪懈, 锌械褉械写邪胁邪械屑芯谐芯 胁 褋褌褉芯泻械 "Host" 蟹邪谐芯谢芯胁泻邪 蟹邪锌褉芯褋邪), 薪械褌. 袙屑械褋褌芯 褝褌芯谐芯 写懈褉械泻褌懈胁邪屑懈 listen 芯锌懈褋褘胁邪褞褌褋褟 胁褋械 邪写褉械褋邪 懈 锌芯褉褌褘, 薪邪 泻芯褌芯褉褘褏 薪褍卸薪芯 锌褉懈薪懈屑邪褌褜 褋芯械写懈薪械薪懈褟 写谢褟 褝褌芯谐芯 褋械褉胁械褉邪, 懈 胁 写懈褉械泻褌懈胁械 server_name 褍泻邪蟹褘胁邪褞褌褋褟 胁褋械 懈屑械薪邪 褋械褉胁械褉芯胁. 袩褉懈屑械褉 泻芯薪褎懈谐褍褉邪褑懈懈 芯锌懈褋邪薪 胁 薪邪褋褌褉芯泄泻械 胁懈褉褌褍邪谢褜薪褘褏 褋械褉胁械褉芯胁.

Template:Anchor

[edit] server_name

syntax: server_name 懈屑褟 [...] default: server_name hostname context: server

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 懈屑械薪邪 胁懈褉褌褍邪谢褜薪芯谐芯 褋械褉胁械褉邪, 薪邪锌褉懈屑械褉:

: server {
: server_name   example.com  www.example.com;
: }

袩械褉胁芯械 懈屑褟 褋褌邪薪芯胁懈褌褋褟 芯褋薪芯胁薪褘屑 懈屑械薪械屑 褋械褉胁械褉邪. 袩芯 褍屑芯谢褔邪薪懈褞 懈褋锌芯谢褜蟹褍械褌褋褟 懈屑褟 屑邪褕懈薪褘 (hostname). 袙 懈屑械薪邪褏 褋械褉胁械褉芯胁 屑芯卸薪芯 懈褋锌芯谢褜蟹芯胁邪褌褜 "*" 写谢褟 蟹邪屑械薪褘 锌械褉胁芯泄 褔邪褋褌懈 懈屑械薪懈:

: server {
: server_name   example.com  *.example.com;
: }

袛胁邪 胁褘褕械锌褉懈胁械写褢薪薪褘褏 懈屑械薪懈 屑芯卸薪芯 芯斜褗械写懈薪懈褌褜 胁 芯写薪芯:

: server {
: server_name   .example.com;
: }

袝褋谢懈 褋褌褉芯泻邪 "Host" 胁 蟹邪锌褉芯褋械 薪械 褋芯胁锌邪谢邪 薪懈 褋 芯写薪懈屑 芯锌懈褋邪薪褘屑 褋械褉胁械褉芯屑 懈谢懈 屑邪褋泻芯泄 懈 胁 芯褌胁械褌 薪邪 蟹邪锌褉芯褋 胁褘写邪褢褌褋褟 褉械写懈褉械泻褌, 褌芯 胁 褉械写懈褉械泻褌械 斜褍写械褌 懈褋锌芯谢褜蟹芯胁邪薪芯 芯褋薪芯胁薪芯械 懈屑褟 褋械褉胁械褉邪. 袝褋谢懈 卸械 薪褍卸薪芯 懈褋锌芯谢褜蟹芯胁邪褌褜 懈屑褟, 锌褉懈褕械写褕械械 褋褌褉芯泻械 蟹邪锌褉芯褋邪 "Host", 褌芯 薪褍卸薪芯 懈褋锌芯谢褜蟹芯胁邪褌褜 屑邪褋泻褍 "*":

: server {
: server_name   www.example.com  *;
: }

Template:Anchor

[edit] server_names_hash_max_size

syntax: server_names_hash_max_size 褔懈褋谢芯

default: server_names_hash_max_size 512

context: http

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 屑邪泻褋懈屑邪谢褜薪褘泄 褉邪蟹屑械褉 褏褝褕-褌邪斜谢懈褑 懈屑褢薪 褋械褉胁械褉芯胁. 袩芯写褉芯斜薪械械 褋屑芯褌褉懈 胁 芯锌懈褋邪薪懈懈 薪邪褋褌褉芯泄泻懈 褏褝褕械泄.

{{Anchor|server_names_hash_bucket_size)

[edit] server_names_hash_bucket_size

syntax: server_names_hash_bucket_size 褔懈褋谢芯

default: server_names_hash_bucket_size 32/64/128

context: http

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 褉邪蟹屑械褉 泻芯褉蟹懈薪褘 胁 褏褝褕-褌邪斜谢懈褑邪褏 懈屑褢薪 褋械褉胁械褉芯胁. 袟薪邪褔械薪懈械 锌芯 褍屑芯谢褔邪薪懈褞 蟹邪胁懈褋懈褌 芯褌 褉邪蟹屑械褉邪 褋褌褉芯泻懈 泻褝褕邪 锌褉芯褑械褋褋芯褉邪. 袩芯写褉芯斜薪械械 褋屑芯褌褉懈 胁 芯锌懈褋邪薪懈懈 薪邪褋褌褉芯泄泻懈 褏褝褕械泄.

Template:Anchor

[edit] tcp_nodelay

syntax: tcp_nodelay [on|off]

default: tcp_nodelay on

context: http, server, location

袛懈褉械泻褌懈胁邪 褉邪蟹褉械褕邪械褌 懈谢懈 蟹邪锌褉械褖邪械褌 懈褋锌芯谢褜蟹芯胁邪褌褜 芯锌褑懈褞 TCP_NODELAY. 袨锌褑懈褟 胁泻谢褞褔邪褞褌褋褟 褌芯谢褜泻芯 锌褉懈 锌械褉械褏芯写械 褋芯械写懈薪械薪懈褟 胁 褋芯褋褌芯褟薪懈械 keep-alive.

Template:Anchor

[edit] tcp_nopush

syntax: tcp_nopush [on|off] default: tcp_nopush off context: http, server, location

袛懈褉械泻褌懈胁邪 褉邪蟹褉械褕邪械褌 懈谢懈 蟹邪锌褉械褖邪械褌 懈褋锌芯谢褜蟹芯胁邪褌褜 芯锌褑懈懈 TCP_NOPUSH 胁芯 FreeBSD 懈谢懈 TCP_CORK 胁 Linux. 袨锌褑懈懈 胁泻谢褞褔邪褞褌褋褟 褌芯谢褜泻芯 锌褉懈 懈褋锌芯谢褜蟹芯胁邪薪懈懈 sendfile. 袙泻谢褞褔械薪懈械 芯锌褑懈懈 锌芯蟹胁芯谢褟械褌

  • 锌械褉械写邪胁邪褌褜 蟹邪谐芯谢芯胁芯泻 芯褌胁械褌邪 懈 薪邪褔邪谢芯 褎邪泄谢邪 胁 芯写薪芯屑 锌邪泻械褌械 胁 Linux 懈 胁芯 FreeBSD 4.x;
  • 锌械褉械写邪胁邪褌褜 褎邪泄谢 胁 锌芯谢薪褘褏 锌邪泻械褌邪褏.


Template:Anchor

[edit] types

syntax: types { ... }

context: http, server, location

袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 褋芯芯褌胁械褌褋褌胁懈械 褉邪褋褕懈褉械薪懈褟 懈 MIME-褌懈锌芯胁 芯褌胁械褌芯胁. 袨写薪芯屑褍 MIME-褌懈锌褍 屑芯卸械褌 褋芯芯褌胁械褌褋褌胁芯胁邪褌褜 薪械褋泻芯谢褜泻芯 褉邪褋褕懈褉械薪懈泄. 袩芯 褍屑芯谢褔邪薪懈褞 懈褋锌芯谢褜蟹褍械褌褋褟 褌邪泻懈械 褋芯芯褌胁械褌褋褌胁懈褟:

: types {
: text/html    html;
: image/gif    gif;
: image/jpeg   jpg;
: }

袛芯褋褌邪褌芯褔薪芯 锌芯谢薪邪褟 褌邪斜谢懈褑邪 褋芯芯褌胁械褋褌胁懈泄 胁褏芯写懈褌 胁 写懈褋褌褉懈斜褍褌懈胁 懈 薪邪褏芯写懈褌褋褟 胁 褎邪泄谢械 conf/mime.types.

袛谢褟 褌芯谐芯, 褔褌芯斜褘 写谢褟 芯锌褉械写械谢褢薪薪芯谐芯 location'邪 写谢褟 胁褋械褏 芯褌胁械褌芯胁 胁褘写邪胁邪谢褋褟 MIME-褌懈锌 "application/octet-stream", 屑芯卸薪芯 懈褋锌芯谢褜蟹芯胁邪褌褜 褋谢械写褍褞褖械械:

: location /download/ {
: types         { }
: default_type  application/octet-stream;
: }


[edit] 袙褋褌褉芯械薪薪褘械 锌械褉械屑械薪薪褘械

袦芯写褍谢褜 ngx_http_core_module 锌芯写写械褉卸懈胁邪械褌 胁褋褌褉芯械薪薪褘械 锌械褉械屑械薪薪褘械, 懈屑械薪邪 泻芯褌芯褉褘褏 褋芯胁锌邪写邪褞褌 褋 懈屑械薪邪屑懈 锌械褉械屑械薪薪褘褏 胁 Apache. 袩褉械卸写械 胁褋械谐芯, 褝褌芯 锌械褉械屑械薪薪褘械, 锌褉械写褋褌邪胁谢褟褞褖懈械 懈蟹 褋械斜褟 褋褌褉芯泻懈 蟹邪谐芯谢芯胁泻邪 蟹邪锌褉芯褋邪 泻谢懈械薪褌邪, 薪邪锌褉懈屑械褉, $http_user_agent, $http_cookie 懈 褌芯屑褍 锌芯写芯斜薪芯械. 袣褉芯屑械 褌芯谐芯, 械褋褌褜 懈 写褉褍谐懈械 锌械褉械屑械薪薪褘械:

  • $args, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 邪褉谐褍屑械薪褌邪屑 胁 褋褌褉芯泻械 蟹邪锌褉芯褋邪;
  • Template:Anchor$content_length, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 褋褌褉芯泻械 "Content-Length" 胁 蟹邪谐芯谢芯胁泻械 蟹邪锌褉芯褋邪;
  • Template:Anchor$content_type, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 褋褌褉芯泻械 "Content-Type" 胁 蟹邪谐芯谢芯胁泻械 蟹邪锌褉芯褋邪;
  • Template:Anchor$document_root, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 蟹薪邪褔械薪懈褞 写懈褉械泻褌懈胁褘 root 写谢褟 褌械泻褍褖械谐芯 蟹邪锌褉芯褋邪;
  • Template:Anchor$document_uri, 褌芯 卸械 褋邪屑芯械, 褔褌芯 懈 $uri;
  • Template:Anchor$host, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 褋褌褉芯泻械 "Host" 胁 蟹邪谐芯谢芯胁泻械 蟹邪锌褉芯褋邪 懈谢懈 懈屑械薪懈 褋械褉胁械褉邪, 薪邪 泻芯褌芯褉褘泄 锌褉懈褕褢谢 蟹邪锌褉芯褋, 械褋谢懈 褝褌芯泄 褋褌褉芯泻懈 薪械褌;
  • Template:Anchor$limit_rate, 褝褌邪 锌械褉械屑械薪薪邪褟 锌芯蟹胁芯谢褟械褌 褍褋褌邪薪芯胁懈褌褜 芯谐褉邪薪懈褔懈械 褋泻芯褉芯褋褌懈 褋芯械写懈薪械薪懈褟;
  • Template:Anchor$request_method, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 屑械褌芯写褍 蟹邪锌褉芯褋邪, 芯斜褘褔薪芯 褝褌芯 "GET" 懈谢懈 "POST";
  • Template:Anchor$remote_addr, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 邪写褉械褋褍 泻谢懈械薪褌邪;
  • Template:Anchor$remote_port, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 锌芯褉褌褍 泻谢懈械薪褌邪;
  • Template:Anchor$remote_user, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 懈屑械薪懈 锌芯谢褜蟹芯胁邪褌械谢褟, 懈褋锌芯谢褜蟹褍械屑芯谐芯 胁 Basic 邪褍褌械薪褌懈褎懈泻邪褑懈懈;
  • Template:Anchor$request_filename, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 锌褍褌懈 泻 褎邪泄谢褍 写谢褟 褌械泻褍褖械谐芯 蟹邪锌褉芯褋邪, 褎芯褉屑懈褉褍械屑芯屑褍 懈蟹 写懈褉械泻褌懈胁 root 懈谢懈 alias 懈 URI 蟹邪锌褉芯褋邪;
  • Template:Anchor$request_uri, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 锌芯谢薪芯屑褍 锌械褉胁芯薪邪褔邪谢褜薪芯屑褍 URI 胁屑械褋褌械 褋 邪褉谐褍屑械薪褌邪屑懈;
  • Template:Anchor$query_string, 褌芯 卸械 褋邪屑芯械, 褔褌芯 懈 $args;
  • Template:Anchor$server_protocol, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 锌褉芯褌芯泻芯谢褍 蟹邪锌褉芯褋邪, 芯斜褘褔薪芯 褝褌芯 "HTTP/1.0" 懈谢懈 "HTTP/1.1";
  • Template:Anchor$server_addr, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 邪写褉械褋褍 褋械褉胁械褉邪, 薪邪 泻芯褌芯褉褘泄 锌褉懈褕褢谢 蟹邪锌褉芯褋. 袣邪泻 锌褉邪胁懈谢芯, 写谢褟 锌芯谢褍褔械薪懈褟 蟹薪邪褔械薪懈褟 褝褌芯泄 锌械褉械屑械薪薪芯泄 写械谢邪械褌褋褟 芯写懈薪 褋懈褋褌械屑薪褘泄 胁褘蟹芯胁. 袛谢褟 褌芯谐芯, 褔褌芯斜褘 懈蟹斜械卸邪褌褜 褋懈褋褌械屑薪芯谐芯 胁褘蟹芯胁邪, 薪褍卸薪芯 褍泻邪蟹褘胁邪褌褜 邪写褉械褋邪 胁 写懈褉械泻褌懈胁邪褏 listen 懈 懈褋锌芯谢褜蟹芯胁邪褌褜 锌邪褉邪屑械褌褉 bind;
  • Template:Anchor$server_name, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 懈屑械薪懈 褋械褉胁械褉邪, 薪邪 泻芯褌芯褉褘泄 锌褉懈褕褢谢 蟹邪锌褉芯褋;
  • Template:Anchor$server_port, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 锌芯褉褌褍 褋械褉胁械褉邪, 薪邪 泻芯褌芯褉褘泄 锌褉懈褕褢谢 蟹邪锌褉芯褋;
  • Template:Anchor$uri, 褝褌邪 锌械褉械屑械薪薪邪褟 褉邪胁薪邪 褌械泻褍褖械屑褍 URI 胁 蟹邪锌褉芯褋械, 芯薪 屑芯卸械褌 芯褌谢懈褔邪褌褜褋褟 芯褌 锌械褉胁芯薪邪褔邪谢褜薪芯谐芯, 薪邪锌褉懈屑械褉, 锌褉懈 胁薪褍褌褉械薪薪懈褏 褉械写懈褉械泻褌邪褏 懈谢懈 锌褉懈 懈褋锌芯谢褜蟹芯胁邪薪懈懈 懈薪写械泻褋薪褘褏 褎邪泄谢芯胁.