Nginx 基础

日期格式 

http_请求头, arg_参数

使用 比如User-Agent 则 $http_user_agent

 log_format  名称  '$http_*******'

模块

sub_status          查看连接,请求状态  常配置在http server location中

random_index     随机主页

sub_filter             替换返回内容

       sub_filter '<h1>Admin' '<h1>ggggg'; //第一个参数是要被替换的,第二个参数是替换后的

  sub_filter_once off;   //替换所有的,默认是on,替换第一个

sub_filter_last_modified  on|off    修改最  常配置缓存时使用  default off

sub_filter_on    on|off   替换第一个字符串   default on

连接, 请求限制

 limt_conn_zone key zone=name:size

作用域 : http

 limit_conn zone(上面的名字) number;

作用域: http,server,location

 limt_req_zone key zone=name:size rate=rate;    rate=1r/s 表示每s一次

作用域 : http

 limit_req zone(上面的名字) [burst=number 下一秒多少可以请求] [nodelay];

作用域: http,server,location

访问模块 http_access_module

allow IP

deny all 

auth_basic 通过htpasswd 生成文件密码信息

  2 alias 与 root区别

IP黑白名单

# location ~ ^/admin.html {
# root /opt/app/code;
# deny 222.128.189.17;
# allow all;
# index index.html index.htm;
# }

location ~ ^/admin.html {
root /opt/app/code;
allow 222.128.189.0/24;
deny all;
index index.html index.htm;
}
原文地址:https://www.cnblogs.com/eason-d/p/11201934.html