Nginx状态监控
--with-http_stub_status_module 记录 Nginx 客户端基本访问状态信息
Syntax: stub_status;
Nginx状态监控
Default: —
Context: server, location
具体配置如下:
location /mystatus {
stub_status on;
access_log off;
}
//Nginx_status概述
Active connections:2 //Nginx当前活跃连接数
server accepts handled requests
16 16 19
server表示Nginx处理接收握⼿总次数。
accepts表示Nginx处理接收总连接数。
请求丢失数=(握⼿数-连接数)可以看出,本次状态显示没有丢失请求。
handled requests,表示总共处理了19次请求。
Reading Nginx读取数据
Writing Nginx写的情况
Waiting Nginx开启keep-alive⻓连接情况下,既没有读也没有写,建⽴连接情况
Nginx下载站点
Nginx默认是不允许列出整个⽬录浏览下载。
Syntax: autoindex on | off;
Default:
autoindex off;
Context: http, server, location
//autoindex常⽤参数
autoindex_exact_size off;
默认为on, 显示出⽂件的确切⼤⼩,单位是bytes。
修改为off,显示出⽂件的⼤概⼤⼩,单位是kB或者MB或者GB。
autoindex_localtime on;
默认为off,显示的⽂件时间为GMT时间。
修改为on, 显示的⽂件时间为⽂件的服务器时间。
charset utf-8,gbk;
默认中⽂⽬录乱码,添加上解决乱码。
配置⽬录浏览功能
//开启⽬录浏览
location / {
root html;
autoindex on;
autoindex_localtime on;
autoindex_exact_size off;
}
网友评论