Nginx and PHP-FPM have built a status page that is very helpful to understand the status of Nginx and to monitor Nginx. For subsequent monitoring, we need to first understand the Nginx status page.
1. Enable Nginx status configuration
Add location to the default host or the host you wish to access.
Copy Code code as follows:
server {
Listen *:80 default_server;
server_name _;
Location/ngx_status
{
Stub_status on;
Access_log off;
#allow 127.0.0.1;
#deny all;
}
}
2. Restart Nginx
Please restart your nginx in accordance with your circumstances.
Copy Code code as follows:
3. Open Status Page
Copy Code code as follows:
# Curl Http://127.0.0.1/ngx_status
Active connections:11921
Server accepts handled requests
11989 11989 11991
reading:0 Writing:7 waiting:42
4. Nginx Status Detailed
Copy Code code as follows:
Active connections– number of actively connected connections
The server accepts handled requests-has handled 11,989 connections, successfully created 11,989 handshakes, and handled 11,991 requests in a total
Reading-reads the number of connections to the client.
Number of writing-response data to client
waiting-Open keep-alive, this value equals active– (reading+writing), meaning that Nginx has finished processing the resident connection waiting for the next request instruction.