Compile and install nginx's http_stub_status_module to monitor its running status

Source: Internet
Author: User

Steps:

1 compile nginx, add the parameter -- with-http_stub_status_module

Take my own compilation options as an example:

# Configuration instructions. /configure -- prefix =/usr/local -- user = nginx -- group = nginx -- with-http_ssl_module -- with-http_realip_module -- http-client-body-temp-Path =/usr/local/var/tmp /nginx/client -- http-proxy-temp-Path =/usr/local/var/tmp/nginx/Proxy -- http-FastCGI-temp-Path =/usr/local/var /tmp/nginx/fcgi -- http-scgi-temp-Path =/usr/local/var/tmp/nginx/scgi -- http-uwsgi-temp-Path =/usr/local /var/tmp/nginx/uwsgi -- with-http_geoip_module -- with-http_stub_status_module

2. Modify the nginx configuration file and add monitoring Status Configuration

Add the following code to the server block of nginx. conf:

location /nginx_status {    # Turn on nginx stats    stub_status on;    # I do not need logs for stats    access_log   off;    # Security: Only allow access from 192.168.1.100 IP #    #allow 192.168.1.100;    # Send rest of the world to /dev/null #    #deny all;}

This code is added to the default server,
Assume that the default server configuration is

listen       127.0.0.1:80;server_name  127.0.0.1;

Then, you can access nginx through curl 127.0.0.1/nginx_status.

The returned results are similar:

Active connections: 1 server accepts handled requests 655 655 1985 Reading: 0 Writing: 1 Waiting: 0 

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.