How to implement Nginx configuration detection service status

How to implement Nginx configuration detection service status

1. Check whether the check status module is installed;

[root@localhost ~]# nginx -V
nginx version: nginx/1.12.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
configure arguments: --prefix=/usr/local/nginx --with-http_sub_module

2. If not installed, recompile and install;

Ø Check status module; --with-http_stub_status_module

[root@localhost ~]# cd /usr/local/src/nginx-1.12.2/       
[root@localhost ~]# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module
[root@localhost ~]# make && make install

3. Edit the nginx configuration file;

[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
server {
  listen 80;
  server_name localhost;
  #access_log logs/host.access.log main;
 
  location /nginx_status {
  stub_status on;
  access_log off;
   #allow 127.0.0.1; ##You can filter visitors to this page#deny all;
   }
  }
[root@localhost ~]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@localhost ~]# nginx -s reload

4. Test grammar;

[root@localhost ~]# curl http://192.168.10.110:80/nginx_status
Active connections: 1
server accepts handled requests
 1 1 1
Reading: 0 Writing: 1 Waiting: 0

5. Detailed explanation of output content;

The first line Active connections: 1 - the number of active connections, including waiting clients 0
The second line server accepts handled requests - a total of 1 connection was handled, 1 handshake was successfully created, and a total of 1 request was handled
The third line shows Reading — the number of connections reading from the client, Writing — the number of response data sent to the client, and Waiting — when keep-alive is enabled, this value is equal to active – (reading+writing), which means that Nginx has processed the resident connections that are waiting for the next request instruction.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of nginx log configuration instructions
  • Detailed explanation of how to use ELK to analyze Nginx server logs
  • Detailed analysis and configuration of access_log in nginx server
  • Shell script analysis of nginx log access times and the most time-consuming pages (slow query)
  • How to connect PHP to Nginx server and parse Nginx log
  • Summary of common commands for Nginx log statistics analysis
  • Nginx service status monitoring method
  • Python monitors nginx port and process status
  • Detailed explanation of Nginx status monitoring and log analysis

<<:  Detailed graphic explanation of how to install and completely delete MySQL by decompression

>>:  JavaScript uses canvas to draw coordinates and lines

Recommend

Detailed explanation of Vue's props configuration

<template> <div class="demo"&g...

Prevent HTML and JSP pages from being cached and re-fetched from the web server

After the user logs out, if the back button on the...

Do you know how to use Vue to take screenshots of web pages?

Table of contents 1. Install html2Canvas 2. Intro...

Solve the problem of blocking positioning DDL in MySQL 5.7

In the previous article "MySQL table structu...

WeChat Mini Program User Authorization Best Practices Guide

Preface When developing WeChat applets, you often...

Install .NET 6.0 in CentOS system using cloud server

.NET SDK Download Link https://dotnet.microsoft.c...

Solution to the problem of repeated pop-up of Element's Message pop-up window

Table of contents 1. Use 2. Solve the problem of ...

Advantages and Problems of XHTML CSS Website Design

XHTML is the standard website design language cur...

How to completely uninstall mysql under CentOS

This article records the complete uninstallation ...

Methods for optimizing Oracle database with large memory pages in Linux

Preface PC Server has developed to this day and h...

Nginx configuration based on multiple domain names, ports, IP virtual hosts

1. Type introduction 1.1 Domain-based virtual hos...

4 flexible Scss compilation output styles

Many people have been told how to compile from th...