Server status configuration example in nginx

Source: Internet
Author: User

In the use of a server monitoring platform http://jiankong.cn above this can monitor your server status, and a series of analysis, it can monitor the status of commonly used server software, we recommend that you use other good functions.
This section describes how to install and configure stub_status of nginx. The stub_status module in Nginx is mainly used to view some Nginx status information. This module is not compiled into Nginx by default. If you want to use this module, you must specify the following when compiling and installing Nginx:

 

The code is as follows: Copy code
./Configure-with-http_stub_status_module

Check whether the installed Nginx contains the stub_status module.

 

The code is as follows: Copy code
/Usr/local/nginx/sbin/nginx-V
Tls sni support disabled
Configure arguments:-prefix =/usr/local/nginx-user = www-group = www-with-http_stub_status_module-with-file-aio-with-http_ssl_module

You can see that this module is installed. Note that it is-V. If it is-v, only the version is displayed.
Configure nginx and add location to the server block.

 

The code is as follows: Copy code
Location/server-status {
Auth_basic "NginxStatus ";
Allow 173.212.220.66;
Deny all;
Stub_status on;
Access_log on;
Auth_basic_user_file/usr/local/nginx/conf/htpasswd;
}

Create an htpasswd file

 

The code is as follows: Copy code
Htpasswd-c/usr/local/nginx/conf nick

Request www.domain.com/server-status. The result is as follows:

The code is as follows: Copy code
Active connections: 2
Server accepts handled requests
24 24 129
Reading: 1 Writing: 1 Waiting: 0

Active connections: Number of Active connections initiated to the backend.
Server accepts handled requests: Nginx processes a total of 24 connections, successfully creates 24 handles (proving that there is no failure in the middle), and processes a total of 129 requests.
Reading: number of headers that Nginx reads to the client.
Writing: The number of headers that Nginx returns to the client.
Waiting: When keep-alive is enabled, this value is equal to active-(reading + writing), which means that Nginx has completed processing and is Waiting for the resident connection of the next request command.
Therefore, when the access efficiency is high and the request is processed quickly, it is normal that the number of Waiting is large. If the number of reading + writing is large, it indicates the concurrent access volume.

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.