How to Enable and Read NGINX Status Page

By: Sunil Kumar |  In: Server  |  Last Updated: 2019/02/12

How to Enable and Read NGINX Status Page

Nginx status page provides real-time data about the Nginx server health. This data can be used to optimize the Nginx server for performance.

Requirements

Before proceeding make sure that your Nginx server is compiled with the ngx_http_stub_status_module .  To check whether the Nginx is compiled with the module or not, run the following command on your terminal-

nginx -V 2>&1 | grep -o with-http_stub_status_module

If you see the following output, you are good to proceed.

http_stub_status_module_check

Nginx Configuration

Now you can enable the status page on http://localhost or on a specific domain. Let say you want to enable on the domain – http://nginx-status.com

To do this open the block file for this domain and add the following code inside the server block

location /nginx_status {
               stub_status on;
               access_log off;
               allow 127.0.0.1;
               deny all;
           }

Here we allowed this page for local server IP. Do not forget to change the IP if you are enabling this for the production server.

After making the changes check the Nginx config syntax and reload the Nginx server

sudo nginx -t
sudo service nginx reload

Accessing the Status Page

Once you have enabled the status page you can check it by going to the URL http://nginx-status.com/nginx_status

It will output like this

Reading the Nginx Status Page

-Active connections

Total no of connection opened on your server. It does not reflect the no. of the current user on the website. Maybe there are multiple connections are opened for a single user.

-accepts

This is the Total no of connection established on that time.

-handled

Shows the total no of handled connections by the Nginx server. Usually, this no is the same as the First one.

-requests

Shows the total no of request handled by the Nginx server. It is usually greater than the first two numbers.

-Reading

The current number of connections where Nginx is reading the request header.

-Writing

The current number of connections where Nginx is writing the response back to the client.

-Waiting

The current number of idle client connections waiting for a request.

Conclusion

Now you will be able to enable status page for your server as well as understanding the status result.

Comments


Leave a Comment

Your email address will not be published.

*


Sunil Kumar


I am the owner of acmeextension. I am a passionate writter and reader. I like writting technical stuff and simplifying complex stuff.
Know More

Join more than 10,000 others Web Developers