• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Monitor Nginx by using Stub Status Module on Ubuntu 21.04

  • 00:34 lsb_release -a
  • 00:54 apt install nginx -y
  • 01:10 systemctl status nginx
  • 01:30 nginx -V 2>&1 | grep --color -- --with-http_stub_status_module
  • 02:26 vim /etc/nginx/sites-available/default
  • 03:37 service nginx reload
  • 04:00 curl http://127.0.0.1/nginx_status
  • 04:44 curl http://127.0.0.1/nginx_status
{{postValue.id}}

To Monitor Nginx by using Stub Status Module on Ubuntu 21.04

Introduction:

The NGINX web server can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. In this module, you will find information about the basic status of the ngx_http_stub_status_context.

Installation Procedure:

Step 1: Check the OS version by using the below command

root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 21.04
Release:	21.04
Codename:	hirsute

Step 2: Install the Nginx by using the below command

root@linuxhelp:~# apt install nginx -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
  libllvm11
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
  libnginx-mod-http-geoip2 libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail
  libnginx-mod-stream libnginx-mod-stream-geoip2 nginx-common nginx-core
Suggested packages:
  fcgiwrap nginx-doc
The following NEW packages will be installed:
  libnginx-mod-http-geoip2 libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail
  libnginx-mod-stream libnginx-mod-stream-geoip2 nginx nginx-common nginx-core
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.

Step 3: Check the status of the Nginx by using the below command

root@linuxhelp:~# systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-01-22 04:44:06 IST; 25s ago
       Docs: man:nginx(8)
    Process: 9631 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 9632 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 9723 (nginx)
      Tasks: 3 (limit: 2254)
     Memory: 4.6M
     CGroup: /system.slice/nginx.service
             ├─9723 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             ├─9726 nginx: worker process
             └─9727 nginx: worker process

Step 4: Check the Presence of stub_status module in Nginx by using the below command

root@linuxhelp:~# nginx -V 2>&1 | grep --color -- --with-http_stub_status_module
configure arguments: --with-cc-opt='-g -O2 -ffile-prefix-map=/build/nginx-DUpigx/nginx-1.18.0=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -flto=auto -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-compat --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --add-dynamic-module=/build/nginx-DUpigx/nginx-1.18.0/debian/modules/http-geoip2 --with-http_addition_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_sub_module

Step 5: Change the default server block with stub_status Module by using the below command

root@linuxhelp:~# vim /etc/nginx/sites-available/default 
server_name _;

        location /nginx_status {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                #try_files $uri $uri/ =404;
                stub_status;
        }

Step 6: Reload the configurations of Nginx by using the below command

root@linuxhelp:~# service nginx reload

Step 7:Curl the following link to see status by using the below command

root@linuxhelp:~# curl http://127.0.0.1/nginx_status
Active connections: 1 
server accepts handled requests
 1 1 1 
Reading: 0 Writing: 1 Waiting: 0 

Step 8: Ping the http://127.0.0.1 in browser for testing purpose Snap 1

Step 9: Curl the following link to see status by using the below command

root@linuxhelp:~# curl http://127.0.0.1/nginx_status
Active connections: 2 
server accepts handled requests
 3 3 5 
Reading: 0 Writing: 1 Waiting: 1 

By this to Monitor Nginx by using Stub Status Module on Ubuntu 21.04 has been completed

Tags:
michael
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

Does the stub_status Module come by default?

A

Stub_status module is not built by default, it should be enabled with the --with-http_stub_status_module configuration parameter.

Q

How do we enable NGINX stub status?

A

Open your browser at http://127.0.0.1:8080/stub_status to access the status.

Q

Which is better, Apache or NGINX?

A

Nginx is the Better because It performs 2.5 times faster than Apache according to a benchmark test running up to 1,000 simultaneous connections.

Q

Why NGINX is so popular?

A

Nginx is popular due to its lightweight resource utilization and its ability to scale easily on minimal hardware.

Q

Does NGINX replace Apache?

A

Apache and Nginx are the two most common open source web servers in the world. ... While Apache and Nginx share many qualities, they should not be thought of as entirely interchangeable

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Luk Van De Looverbosch ?
How to create a root ?

Hello,
How to create root@linuxhelp in Linux Mint 20.1 64-bit ?
Thanks in advance for your reply.
Best regards.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.