语法: absolute_redirect on | off;
默认: absolute_redirect on;
Context:http, server, location
location /i/ {
alias /data/w3/images/;
}
“/i/top.gif”, 对请求到 /data/w3/images/top.gif
path 可以有变量, 除了 $document_root 和 $realpath_root.
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 size;
默认: client_body_buffer_size 8k|16k;
Context:http, server, location
设置读取客户端请求正文的缓冲区大小。如果请求主体大于缓冲区,则整个主体或仅其部分被写入临时文件。默认情况下,缓冲区大小等于两个内存page。这在x86,其他32位平台上是8K。在其他64位平台上通常是16K。
语法:client_body_in_file_only on | clean | off;
默认:client_body_in_file_only off;
Context:http, server, location
语法: 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 time;
默认: client_body_timeout 60s;
Context:http, server, location
客户端与服务器建立连接后发送request body的超时时间。如果客户端在此时间内没有发送任何内容,那么Nginx返回HTTP 408错误(Request Timed Out)
语法:client_header_timeout time;
默认值: client_header_timeout 60s;
客户端向服务器发送一个完整的request header的超时时间。如果客户端在此时间内没有发送一个完整的request header,那么Nginx返回HTTP 408错误(Request Timed Out)
client_header_buffer_size
语法:client_header_buffer_size size;
默认值:client_header_buffer_size 1k;
设置读取请求头的缓冲区大小。对于大多数请求,1K字节的缓冲区就足够了。但是,如果请求包含长Cookie,或者来自WAP客户端,则可能不适合1K。nginx会分配由large_client_header_buffers配置的较大缓冲区。
语法:client_max_body_size size;
默认值:client_max_body_size 1m;
Context:http, server, location
设置允许的请求体最大size,(在请求头的Content-Length中指定)
如果请求超出,nginx返回413 (Request Entity Too Large)错误。
语法:connection_pool_size size;
默认值:connection_pool_size 256|512;
Context:http, server
允许精确调整每个连接的内存分配。这个配置基本上影响不到性能,所以很少使用。
语法:default_type mime-type;
默认值:default_type text/plain;
Context:http, server, location
语法: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;