HowTo: Enable Nginx Status Page

‮tual.www‬turi.com
HowTo: Enable Nginx Status Page

To enable the Nginx status page, you will need to configure an nginx-status location in your Nginx configuration file. Here are the steps to enable the Nginx status page:

  1. Install the nginx-module-vts package. The Nginx status page requires the nginx-module-vts package, which provides the stub_status module for reporting server statistics. You can install the nginx-module-vts package using your package manager. For example, on Debian or Ubuntu:
sudo apt-get install nginx-module-vts
  1. Enable the stub_status module. To enable the stub_status module, you will need to add the following directive to the http block in your Nginx configuration file:
load_module modules/ngx_http_stub_status_module.so;
  1. Configure the nginx-status location. Add the following location block to your Nginx configuration file to enable the Nginx status page:
location /nginx-status {
    stub_status on;
    access_log off;
    allow 127.0.0.1;
    deny all;
}

This location block will enable the Nginx status page at the /nginx-status URL, and allow access only from the local host (127.0.0.1). You can change the allow and deny directives to allow access from other IP addresses or CIDR ranges, if necessary.

  1. Reload the Nginx configuration. After making changes to the Nginx configuration file, you will need to reload the configuration for the changes to take effect. You can use the nginx -s reload command to reload the configuration:
sudo nginx -s reload

By following these steps, you should be able to enable the Nginx status page and access it at the /nginx-status URL. The status page will display server statistics, such as the number of active connections, request rate, and request processing time. You can refer to the Nginx documentation for more information on the stub_status module and the Nginx status page.

Created Time:2017-10-29 22:08:43  Author:lautturi