http_stub_status_module
syntax: stub_status;
default: -
context:server, location
配置:
location /mystatus {
stub_status;
}
瀏覽器訪問:ip/mystatus,結果如下
Active connections: 2
server accepts handled requests
3 3 8
Reading: 0 Writing: 1 Waiting: 1
Active connections: 2 nginx活躍連接數
server accepts handled requests
3 3 8 接受握手的次數 連接數 請求數
Reading: 0 Writing: 1 Waiting: 1 讀 寫 等待
http_random_index_module 目錄中選擇一個隨機主頁,感覺沒什麼用
syntax:random_index on | off;
default:random_index off;
context:location
location / {
root /usr/share/nginx/html;
random_index on;
}
http_sub_module 返回給客戶端的http內容替換,(防火牆可以做到)
syntax:sub_filter string replacement;
default:-
context:http, server, location
syntax:sub_filter_last_modified on | off;
default:sub_filter_last_modified off;
context:htp, server, location
syntax:sub_filter_once on | off;
default:sub_filter_once on;
context:http, server, location
配置:
location / {
sub_filter '徐' '徐凱';
}
index.html 代碼內容如下
徐<br/>
徐凱<br/>
徐徐<br/>
瀏覽器訪問內容如下:
徐凱
徐凱
徐徐
配置:
location / {
sub_filter: '徐' '徐凱';
sub_filter_once: off;//關閉只匹配一個,就是替換多個
}
瀏覽器訪問如下:
徐凱
徐凱凱
徐凱徐凱
http
http1.0 tcp不能複用
http1.1 順序性tcp複用
http2.0 多路複用tcp複用
http請求建立在一次tcp連接的基礎上
一次tcp請求至少產生一次http請求
ab測壓
ab -n 50 -c 20 http://192.168.238.205/index.html
請求數50 併發數20
limit_conn_module 連接頻率限制
syntax: limit_conn_zone key zone=name:size;
default:-
context:http
syntax: limit_conn zone number;
default:-
context:http,server,location
limit_req_module 請求頻率限制
syntax:limit_req_zone key zone=name:size rate=rate;
default:-
context:http
syntax:limit_req zone=name [burst=number][nodely];
default:-
context:http, server,location
訪問控制
基於ip的訪問控制 - http_access_module
syntax: allow address | cidr(網段) | unix:| all;
default: -
context: http, server, location, limit_except
syntax: deny address | cidr | unix: | all;
default: -
context:http, server, location, limit_except
基於用戶的信任登錄 - http_auth_basic_module