nginx状态信息功能

【nginx状态信息功能】
nginx状态信息(status)配置及信息详解 nginx与php-fpm一样内建了一个状态页,对于想了解nginx状态
以及监控nginx非常有帮助。为了后续的zabbix监控,我们需要先了解一下nginx的状态页。

nginx状态信息介绍nginx软件在编译时有一个with-http_stub_status_module模块,这个模块功能
是记录nginx 的基本访问状态信息,让使用者了解nginx的工作状态。想要使用状态模块,在编译时必须
增加with-http_stub_status_module参数。


检查Nginx是否开启此功能
[root@bogon conf]# nginx -V
nginx version: nginx/1.14.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/opt/nginx/ --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-http_stub_status_module --with-threads --with-file-aio


如果有,那么修改nginx.conf,支持此功能
 1.[root@backup nginx_yy]# vim /opt/tngx232/conf/extra/status.conf
 
server {
  listen 85;                #自己定义一个监听端口
  location / {
         stub_status on;    #打开状态信息功能
         access_log off;    #关闭日志访问功能
}
}



2.配置完成后,检查nginx语法,然后重启
[root@backup nginx_yy]# nginx -t
nginx: the configuration file /opt/tngx232/conf/nginx.conf syntax is ok
nginx: configuration file /opt/tngx232/conf/nginx.conf test is successful
[root@backup nginx_yy]# nginx -s reload


3.用浏览器访问nginx 10.0.0.200:85




4.使用ab命令,对nginx进行压力测试
yum -y install httpd-tools

ab -kc 1000 -n 100000 http://10.0.0.200/  #开启会话保持,1000个并发,发送十万个请求

-n requests #执行的请求数,即一共发起多少请求。
-c concurrency #请求并发数。
-k #启用HTTP KeepAlive功能,即在一个HTTP会话中执行多个请求。


 

 



posted @ 2020-08-01 23:30  王子建  阅读(224)  评论(0)    收藏  举报