一、 正向代理和反向代理
1.1 Porxy代理
模块
ngx_http_proxy_module
语法
代理
Syntax: proxy_pass URL; 代理的后端服务器URL
Default: —
Context: location, if in location, limit_except
缓冲区
Syntax: proxy_buffering on | off;
Default: proxy_buffering on; 缓冲开关
Context: http, server, location
proxy_buffering开启的情况下,nignx会把后端返回的内容先放到缓冲区当中,然后再返回给客户端
(边收边传,不是全部接收完再传给客户端)。
Syntax: proxy_buffer_size size;
Default: proxy_buffer_size 4k|8k; 缓冲区大小
Context: http, server, location
Syntax: proxy_buffers number size;
Default: proxy_buffers 8 4k|8k; 缓冲区数量
Context: http, server, location
Syntax: proxy_busy_buffers_size size;
Default: proxy_busy_buffers_size 8k|16k; 忙碌的缓冲区大小,控制同时传递给客户端的buffer数量
Context: http, server, location
头信息
Syntax: proxy_set_header field value;
Default: proxy_set_header Host $proxy_host; 设置真实客户端地址
proxy_set_header Connection close;
Context: http, server, location
超时
Syntax: proxy_connect_timeout time;
Default: proxy_connect_timeout 60s; 链接超时
Context: http, server, location
Syntax: proxy_read_timeout time;
Default: