Nginx in stub_status module is used to view some of Nginx status information. This module is not installed by default, you need to compile and install. Open stub_status nginx module configuration is as follows:
Step 1: Check nginx when mounting the module.
/ usr / local / nginx / sbin
Note the capital V, lowercase v is to look at the version information
This module must be, otherwise you need to install.
Step 2: Install stub_status module
(Note: Some words can ignore this step, do not install)
nginx has a statistics module, when compiled and installed together with the parameter "--with-http_stub_status_module", on this module installed .
Command is as follows:
./configure --with-http_stub_status_module
The third step: nginx profile modification
in server add the following block as follows:
# performance statistics
LOCATION / Nginx-Status {
stub_status ON;
access_log OFF;
the allow 203.93.215.156; # which allows access ip
}
Step four: Restart nginx
After modifying the configuration file, check configuration file syntax is correct, then restart correctly.
/ usr / local / nginx / sbin / nginx -t
/ usr / local / nginx / sbin / nginx -s reload
Step five: View of Nginx in the browser status
Configuration as shown above: My visit should be: http://www.wuneng.info/nginx-status
Enter the "domain name / nginx-status" will show the results of statistics since the last start nginx working condition.
第六步:返回各数据项说明
Active connections: 当前nginx正在处理的活动连接数.
Server accepts handled requests request_time: nginx总共处理了13057 个连接,成功创建13057 握手(证明中间没有失败的),总共处理了11634 个请求,总共请求时间2230854。
Reading: nginx读取到客户端的Header信息数.
Writing: nginx返回给客户端的Header信息数.
Waiting: 开启keep-alive的情况下,这个值等于 active – (reading + writing),意思就是nginx已经处理完成,正在等候下一次请求指令的驻留连接。
所以,在访问效率高,请求很快被处理完毕的情况下,Waiting数比较多是正常的.如果reading +writing数较多,则说明并发访问量非常大,正在处理过程中。