NoteDeep

absolute_redirect

语法: absolute_redirect on | off; 默认: absolute_redirect on;
Context:http, server, location
如果禁用,则由nginx发出的重定向将是相对的。

alias

语法:alias path; 默认:无
Context:location
可以替换匹配到的部分
location /i/ {
alias /data/w3/images/;
}
/i/top.gif”, 对请求到 /data/w3/images/top.gif

path 可以有变量, 除了 $document_root$realpath_root.
如果有正则,path可以带入匹配到的值
location ~ ^/users/(.+\.(?:gif|jpe?g|png))$ {
alias /data/w3/images/$1;
}

下面两个的配置效果相同。
location /images/ {
alias /data/w3/images/;
}

location /images/ {
root /data/w3;
}

chunked_transfer_encoding

语法:chunked_transfer_encoding on | off; 默认:chunked_transfer_encoding on;
Context:http, server, location 允许在HTTP/1.1中禁用分块传输编码

client_body_buffer_size

语法: client_body_buffer_size size; 默认: client_body_buffer_size 8k|16k;
Context:http, server, location
设置读取客户端请求正文的缓冲区大小。如果请求主体大于缓冲区,则整个主体或仅其部分被写入临时文件。默认情况下,缓冲区大小等于两个内存page。这在x86,其他32位平台上是8K。在其他64位平台上通常是16K。

client_body_in_file_only

语法:client_body_in_file_only on | clean | off; 默认:client_body_in_file_only off;
Context:http, server, location
nginx是否将请求正文保存到文件中。

client_body_temp_path

语法: client_body_temp_path path [level1 [level2 [level3]]];
默认: 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/ 目录下


client_body_timeout

语法:client_body_timeout time; 默认: client_body_timeout 60s;
Context:http, server, location
客户端与服务器建立连接后发送request body的超时时间。如果客户端在此时间内没有发送任何内容,那么Nginx返回HTTP 408错误(Request Timed Out)

client_header_timeout

语法:client_header_timeout time; 默认值: client_header_timeout 60s;
Context:http, server

客户端向服务器发送一个完整的request header的超时时间。如果客户端在此时间内没有发送一个完整的request header,那么Nginx返回HTTP 408错误(Request Timed Out)


client_header_buffer_size

语法:client_header_buffer_size size; 默认值:client_header_buffer_size 1k;
Context:http, server
设置读取请求头的缓冲区大小。对于大多数请求,1K字节的缓冲区就足够了。但是,如果请求包含长Cookie,或者来自WAP客户端,则可能不适合1K。nginx会分配由large_client_header_buffers配置的较大缓冲区。

client_max_body_size

语法:client_max_body_size size; 默认值:client_max_body_size 1m;
Context:http, server, location
设置允许的请求体最大size,(在请求头的Content-Length中指定)
如果请求超出,nginx返回413 (Request Entity Too Large)错误。
设置size=0,可以禁止对请求体大小的检查。

connection_pool_size

语法:connection_pool_size size; 默认值:connection_pool_size 256|512;
Context:http, server 允许精确调整每个连接的内存分配。这个配置基本上影响不到性能,所以很少使用。

default_type

语法:default_type mime-type; 默认值:default_type text/plain;
Context:http, server, location

定义默认的响应的MIME type

error_page

语法:error_page code ... [=[response]] uri; 默认:—
Context:http, server, location, if in location 定义特定错误发生时展示的url,uri可以包含变量
例子:
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;

错误发生后,get方式重定向到相应的uri。

评论列表

    absolute_redirect
    alias
    chunked_transfer_encoding
    client_body_buffer_size
    client_body_in_file_only
    client_body_temp_path
    client_body_timeout
    client_header_timeout
    client_header_buffer_size
    client_max_body_size
    connection_pool_size
    default_type
    error_page