系统版本如下:
[root@localhost ~]# uname -r
3.10.0-693.el7.x86_64
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
加入模块,进行编译安装:
[root@localhost nginx-1.15.5]# ./configure --with-http_stub_status_module
[root@localhost nginx-1.15.5]# make && make install
检查模块加载情况:
[root@localhost nginx-1.15.5]# nginx -V
nginx version: nginx/1.15.5
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)
configure arguments: --with-http_stub_status_module
修改配置文件,添加以下内容:
[root@localhost nginx-1.15.5]# vim /usr/local/nginx/conf/nginx.conf
···
server {
···
location ~ /status{
stub_status on;
access_log off;
}
···
}
···
检测配置文件情况:
[root@localhost nginx-1.15.5]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
重启:
[root@localhost nginx-1.15.5]# nginx -s stop
[root@localhost nginx-1.15.5]# nginx
浏览器打开:
http://192.168.1.117/status
显示:
Active connections: 1
server accepts handled requests
1 1 8
Reading: 0 Writing: 1 Waiting: 0
网友评论