Nginx has a module called --with-http_stub_status_module. After installing it when compiling and installing nginx, you will be able to see the status monitoring page of nginx.
If you installed a newer version of nginx in yum mode, you may also have its own stub_status module.
Compile and install nginx such as: ./configure --with-http_stub_status_module
Assuming that you have compiled and installed nginx (if not installed, please refer to this post " Compiling and installing nginx on centos7 ")
Then go to the server{} area in your site configuration file and add the following code.
Everyone usually compiles and installs nginx to /usr/local/nginx. Then the configuration file is /usr/local/nginx/conf/nginx.conf
location /nginx_status {
stub_status on;
access_log off;
allow 192.168.0.0/24;
deny all;
}
nginx_status is the path we will use to access the status page in the future, such as http://www.hiibm.com/nginx_status. This path string can be written in the configuration file as you like. Then the URL will be the same as your customized one.
stub_status on; is to open the corresponding module
allow 192.168.0.0/24; is to allow which hosts can access the nginx status monitoring page
Test the effect.