记录Nginx模块开发
- --with-http_stub_status_module模塊:Nginx的客戶端狀態
??????????? Syntax:stub_status
??????????? Default:--
??????????? Content:server,location
location /mystatus{
?? stub_status;
}
>>效果圖
?
- --with-http_random_index_module模塊:目錄中選擇一個隨機主頁
??????????? Syntax:random_index on|off
??????????? Default:random_index off;
??????????? Content:location
location /{
?? root? 隨機文件的文件夾;
?? random_index on;
}
?
- --with-http_sub_module模塊:http內容替換
??????????? Syntax:sub_filter string replacement
??????????? Default:--
??????????? Content:http,server,location
location /{
? sub_filter '被替換值' '替換值';
}
?
- --with-http_limit_conn_module模塊:連接限制
??????????? Syntax:limit_conn_zone key zone=name:size;
??????????? Default:--
??????????? Content:http
??????????? Syntax:limit_conn [zone] number;
??????????? Default:--
??????????? Content:http,server,location
limit_conn_zone $binary_remote_addr zone=conn_zone:1m;
server{
location / {
?????????? limit_conn conn_zone 1;
}
}
- --with-http_limit_req_module模塊:請求限制
??????????? Syntax:limit_req_zone key zone=name:size rate=size;
??????????? Default:--
??????????? Content:http
??????????? Syntax:limit_req zone=name [burst=number][nodelay];
??????????? Default:--
??????????? Content:http
limit_req_zone $binary_remote_addr zone=req_zone:1m rate=1r/s;
server{
location / {
?????????? #limit_req zone=req_zone;
?????????? #limit_req zone=req_zone burst=3;
?????????? #limit_req zone=req_zone burst=3 nodelay;}
?
- --with-http_access_module模塊:訪問控制-基于IP的訪問控制
??????????? Syntax:allow address | CIDR | unix: |all;
??????????? Default:--
??????????? Content:http,server,location,limit_except;
??????????? Syntax:deny address | CIDR | unix: |all;
??????????? Default:--
??????????? Content:http,server,location,limit_except;
server{
location / {
?????????? root?? /usr/share/nginx/html;
?????????? index? index.html index.htm;
?????? }
?????? location ~^ / 50x.html {
?????????? root?? /usr/share/nginx/html;
?????????? #allow 117.30.57.5;
?????????? #allow 117.30.57.5/40;#允許5-40IP地址段訪問
?????????? deny all;
?????? }
}?
- --with-http_auth_basic_module模塊:訪問控制-基于用戶的信任登陸
??????????? Syntax:auth_basic string|off;
??????????? Default:auth_basic off;
??????????? Content:http,server,location,limit_except
??????????? Syntax:auth_basic_user_file file;
??????????? Default:--
??????????? Content:http,server,location,limit_except
?
轉載于:https://www.cnblogs.com/chenbingquan/p/10711466.html
總結
以上是生活随笔為你收集整理的记录Nginx模块开发的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PHP框架 one 1.6.0 发布
- 下一篇: 聊聊spring tx的EnableTr