Nginx status is configured on the Nginx to view the server running status _nginx

Source: Internet
Author: User

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 Zabbix monitoring, we need to first understand how the Nginx status page is going.
1. Enable Nginx status configuration
add location to the default host or the host you wish to access.

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.

# Service Nginx Restart

3. Open Status Page

# 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

    • 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.

Script, the following directives specify the ability to enable getting nginx working status.

  Location/nginxstatus { 
      stub_status on; 
 Access_log   Logs/nginxstatus.log; 
      Auth_basic   "Nginxstatus"; 

  }

Active connections:2 
 Server accepts handled requests 
129 reading:1 writing:1 

waiting:0 

    • Active connections: The number of active connections initiated on the backend.
    • The Server accepts handled Requests:nginx handled 24 connections, successfully creating 24 handshakes (proving that there were no failures), processing 129 requests in total.
    • Reading:nginx the number of header information read to the client.
    • Writing:nginx the number of header information returned to the client.
    • Waiting: When Keep-alive is turned on, this value equals active– (reading + writing), meaning that the nginx has been processed and is waiting for the next request to host the connection.

Therefore, in the case of high efficiency, the request is quickly processed, the number of waiting is normal. If the number of reading +writing is higher, the amount of concurrent traffic is indicated.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.