系統(tǒng)版本如下:
[root@localhost ~]# uname -r
3.10.0-693.el7.x86_64
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
加入模塊力奋,進(jìn)行編譯安裝:
[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
修改配置文件,添加以下內(nèi)容:
[root@localhost nginx-1.15.5]# vim /usr/local/nginx/conf/nginx.conf
···
server {
···
location ~ /status{
stub_status on;
access_log off;
}
···
}
···
檢測(cè)配置文件情況:
[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
nginx-1.png