http_stub_status_module nginx连接状态 1 在虚拟网站内配置 server{
location = /nginx_status
{
stub_status;
allow all;
}
}
访问/nginx_status即可
Active connections: 2 (当前连接数)
server accepts handled requests
3846 3846 5987 接受了3846个连接,处理了3846个,共处理了5987个请求
Reading: 0 Writing: 1 Waiting: 1 正在读取0个,写入1个,等待1个
Keepalive (长连接保持)
keepalive_timeout 65s;
可在http设置全局 也可以在server设置网站
random_index_module 随机索引 只能在location配置 random_index on;
sub_module 模块是一个滤波器 它通过将一个指定的字符串替换为另一个字符串来修改一个响应(替换模块) 在server或location配置 sub_filter '原文' '修改' sub_filter_once off;
http_core_module sendfile on|off tcp_nopush tcp_nodelay
压缩模块
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain # 纯文本文件 text/css # CSS 样式表 text/xml # XML 文件 text/javascript # JavaScript 文件(旧版 MIME) application/json # JSON 数据(API 响应) application/javascript # JavaScript 文件(标准 MIME) application/xml # XML 文件(标准 MIME) application/xml+rss # RSS 订阅源 image/svg+xml # SVG 矢量图(文本格式,压缩效果好) font/ttf # TTF 字体文件 font/otf; # OTF 字体文件
gzip_min_length 1024;
gzip_disable "msie6";
expires [time] 浏览器缓存模块
ngx_http_referer_modul 防盗链模块 指令 valid_referers