In the Nginx plug-in module, there is a module stub_status can monitor the Nginx some status information, the default installation may not have this module, manually compile the time to add a bit.
1. Module installation
First use the command to see if the module is already installed:
[[email protected] nginx]#./nginx-V (v Caps displays information such as version numbers and modules, and V lowercase displays only version information.)
If it is already installed,--with-http_stub_status_module information is included in the information that is displayed. If you do not have this module, you need to reinstall the command as follows:
./configure–with-http_stub_status_module
2. Nginx Configuration
After installation, simply modify the Nginx configuration and configure the following:
Location/hxbcdnstatus { stub_status on ; Access_log off; 127.0. 0.1 ; Deny all; #auth_basic "nginxstatus"; #auth_basic_user_file conf/Nginxstaus;}
Local access is the default here, and if you can see the IP that needs to be added remotely or simply remove the deny all. Encrypted files can be created using the #htpasswd-c/usr/nginx/conf HXB command. The Nginx service needs to be restarted after the configuration is complete.
The state configuration can only be for an nginx service. Nginx is not yet able to monitor a single site.
3. Status View
After the configuration is completed, enter Http://127.0.0.1/hxbcdnstatus view in the browser, displaying the following information:
1075 1064 6253 0 5
4. Parameter description
Active connections– number of connected connections
A total of 107,520,387 connections were processed by the server accepts handled requests-, and 107,497,834 handshakes were successfully created, with a total of 639,121,056 requests processed
Each connection has three states waiting, reading, writing
Reading-reads the number of header information for the client. This operation only reads the header information and immediately enters the writing state after reading, so the time is very short.
writing-the number of header information in the response data to the client. This operation not only reads the head, but also waits for the service to respond, so the time is longer.
waiting-the host connection to wait for the next request instruction after opening keep-alive.
Under normal circumstances, the number of waiting is more, and does not indicate poor performance. Instead, if the number of reading+writing is more, it indicates a problem with service concurrency.
Add:
To view the number of Nginx concurrent processes: Ps-ef | grep Nginx | Wc-l
View Web server TCP connection status: Netstat-n | awk '/^tcp/{++s[$NF]} END {for (a in S) print A, s[a]} '
Nginx Service Status Monitoring