nginx ngx_http_core_module(http server location)

语法默认描述
absolute_redirect on ? off;onhttp, server, location绝对路径
aio on ? offthreads[=pool];offhttp, server, location
aio_write on ? off;http, server, location
alias path;location
chunked_transfer_encoding on ? off;onhttp, server, location块传输
client_body_buffer_size size;8k?16khttp, server, location请求的buffer
client_body_in_file_only on ? clean ? off;offhttp, server, location是否将请求保存到文件,debug使用
client_body_in_single_buffer on ? off;offhttp, server, location是否将请求保存在buffer中
client_body_temp_path path [level1 [level2 [level3]]];client_body_temphttp, server, location临时存放请求的文件
client_body_timeout time;60shttp, server, location读取请求体的超时时间
client_header_buffer_size size;1khttp, server请求头的buffer
client_header_timeout time;60shttp, server请求头的超时时间
client_max_body_size size;1mhttp, server, location请求体大小的上限
connection_pool_size size;256?512http, server每个连接的内存空间大小
default_type mime-type;text/plainhttp, server, location相应的MIME类型
directio size ? off;offhttp, server, location?
directio_alignment size;512http, server, location?
disable_symlinks off;offhttp, server, location?
error_page code … [=[response]] uri;http, server, location, if in location错误页面显示
etag on ? off;onhttp, server, location?
http { … }main
if_modified_since off ? exact ? before;exacthttp, server, locationSpecifies how to compare modification
ignore_invalid_headers on ? off;onhttp, server?
internal;location??
keepalive_disable none ? browser …;msie6http, server, location?
keepalive_requests number;100http, server, location?
keepalive_timeout timeout [header_timeout];75shttp, server, location
large_client_header_buffers number size;4 8khttp, server
limit_except method … { … }location
limit_rate rate;0http, server, location, if in location
limit_rate_after size;0http, server, location, if in location
lingering_close off ? on ? always;onhttp, server, location
lingering_time time;30shttp, server, location
lingering_timeout time;5shttp, server, location
listen address[:port]*:80server监听端口
location [ = ~ ~* ^~ ] uri { ... }server, location
log_not_found on ? off;onhttp, server, location
log_subrequest on ? off;offhttp, server, location
max_ranges number;http, server, location
merge_slashes on ? off;onhttp, server
msie_padding on ? off;onhttp, server, location
msie_refresh on ? off;offhttp, server, location
open_file_cache off;offhttp, server, location
open_file_cache_errors on ? off;offhttp, server, location
open_file_cache_min_uses number;1http, server, location
open_file_cache_valid time;60shttp, server, location
output_buffers number size;2 32khttp, server, location
port_in_redirect on ? off;onhttp, server, location
postpone_output size;1460http, server, location
read_ahead size;0http, server, location
recursive_error_pages on ? off;offhttp, server, location
request_pool_size size;4khttp, server
reset_timedout_connection on ? off;offhttp, server, location
resolver address … [valid=time] [ipv6=onoff] [status_zone=zone];http, server, location
resolver_timeout time;30shttp, server, location
root path;htmlhttp, server, location, if in location
satisfy all ? any;allhttp, server, location
send_lowat size;0http, server, location
send_timeout time;60shttp, server, location
sendfile on ? off;offhttp, server, location, if in location
sendfile_max_chunk size;0http, server, location
server { … }-http
server_name name …;“”server虚拟服务
server_name_in_redirect on ? off;offhttp, server, location
server_names_hash_bucket_size size;32?64?128http
server_names_hash_max_size size;512http
server_tokens on ? off ? build ? string;onhttp, server, location
subrequest_output_buffer_size size;4k?8khttp, server, location
tcp_nodelay on ? off;onhttp, server, location
tcp_nopush on ? off;offhttp, server, location
try_files file … uri;server, location
types { … }
types_hash_bucket_size size;
types_hash_max_size size;
underscores_in_headers on ? off;
variables_hash_bucket_size size;
variables_hash_max_size size;

alias root

location /i/ {
    alias /data/w3/images/;
}

on request of “/i/top.gif”, the file /data/w3/images/top.gif will be sent.

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

The /data/w3/i/top.gif file will be sent in response to the “/i/top.gif” request.

error

error_page 404             /404.html;
error_page 500 502 503 504 /50x.html;

limit_except

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

listen

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

If only address is given, the port 80 is used.
The ssl parameter specifying that all connections accepted on this port should work in SSL mode

location

server_name

反向代理的目标,可以是域名,可以是ip

https://www.jianshu.com/p/181872fd4de3

参考:
http://nginx.org/en/docs/http/ngx_http_core_module.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值