[root@localhost ~]# cd /usr/local/src/nginx-1.12.2/
[root@localhost ~]# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module
[root@localhost ~]# make && make install
3. 编辑nginx 的配置文件;
[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
server {
listen 80;
server_name localhost;
#access_log logs/host.access.log main;
location /nginx_status {
stub_status on;
access_log off;
#allow 127.0.0.1; ##可对该页面的访问者进行过滤
#deny all;
}
}
[root@localhost ~]# 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 -s reload
4.测试语法;
[root@localhost ~]# curl http://192.168.10.110:80/nginx_status
Active connections: 1
server accepts handled requests
1 1 1
Reading: 0 Writing: 1 Waiting: 0