Original: http://www.cnblogs.com/hanyifeng/p/5830013.html
First, Nginx status monitor
Same as server status in Apache. The contents of the output are as follows:
1th column:
- Number of connections currently established with HTTP, including waiting client connections: 2
2nd Column:
- Total client connections accepted: 20
- Total number of client connections processed: 20
- Client total number of requests: 50
3rd column:
- Current, Nginx read request connection
- Currently, the Nginx write response is returned to the client
- How many idle clients are currently requesting a connection
Second, enable status conditions
1. Check the installation configuration of the current Nginx
[Email protected] ~]# Nginx-Vnginx Version:nginx/1.10.1built by GCC4.8.5 20150623(Red Hat4.8.5-4) (GCC) built with OpenSSL1.0.1e-fips OneFeb -TLS SNI Support enabledconfigure arguments:--prefix=/etc/nginx--sbin-path=/usr/sbin/nginx--modules-path=/usr/lib64/nginx/Modules--conf-path=/etc/nginx/nginx.conf--error-log-path=/var/log/nginx/error.log--http-log-path=/var/log/nginx/Access.log--pid-path=/var/run/nginx.pid--Lock-path=/var/run/nginx.Lock--http-client-body-temp-path=/var/cache/nginx/client_temp--http-proxy-temp-path=/var/cache/nginx/proxy_temp--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp--http-scgi-temp-path=/var/cache/nginx/scgi_temp--user=nginx--group=Nginx--with-http_ssl_module--with-http_realip_module--with-http_addition_module--with-http_sub_module--with-Http_dav_module--with-http_flv_module--with-http_mp4_module--with-http_gunzip_module--with-http_gzip_static_module--with-Http_random_index_module--with-http_secure_link_module--with-http_stub_status_module--with-http_auth_request_module--with-http_xslt_ module=Dynamic --with-http_image_filter_module=Dynamic--with-http_geoip_module=Dynamic--with-http_perl_module=Dynamic --add-Dynamic-module=njs-1c50334fbea6/nginx--with-threads--with-stream--with-stream_ssl_module--with-http_slice_module-- with-Mail--with-mail_ssl_module--with-file-aio--with-ipv6--with-http_v2_module--with-cc-opt='-o2-g-pipe-wall-wp,-d_fortify_source=2-fexceptions-fstack-protector-strong--param=ssp-buffer-size=4-grecord-gcc-switches-m64-mtune=generic'
If you can see the--with-http_sub_module module in your environment, it means that status can be enabled. If not, you can add them at compile time.
- Now edit the Nginx configuration file. We create a new configuration file/etc/nginx/conf.d/status.conf, which reads as follows
[Email protected] ~]# cat/etc/nginx/conf.d/status.confserver { 8080; Access_log off; server_name localhost; /var/www/html; /Nginx_status { stub_status on; Access_log off; 223 . xxx.xxx.xxx; 139.59. 253.208 ; Deny all; }}
The visitor to the page is filtered and the access is disabled for writing to the log file.
3. After restarting Nginx, add/nginx_status to the website.
Http://101.201.238.125:8080/nginx_status
Nginx Server Open Status page detection service status