How to add stub_status for nginx?

How to add stub_status route for nginx?

I see that nginx installed with-http_stub_status_module flag, but as I understand stub_status location is disabled by default, which config I should edit for adding this route /stub_status?

I want to add nginx collector for netdata monitor (NGINX collector | Learn Netdata) and I need route like this:
jobs:

Any success?

  1. Configure Nginx:
    In Nginx’s configuration file (usually ‘/etc/nginx/nginx.conf’ or a file contained in the ‘/etc/nginx/conf.d/’ or ‘/etc/nginx/sites-available/’ directory), add the following to enable ‘stub_status’:
   server {
       listen 80;
       server_name _;
       location /nginx_status {
           stub_status on;
           access_log off;
           # Restrict access and only allow access from specific IPs
           allow 127.0.0.1;
           deny all;
       }
   }

This configuration creates a virtual server that listens on port 80 and enables ‘stub_status’ for the ‘/nginx_status’ path. The ‘allow’ and ‘deny’ directives are used to restrict access to ensure that only specific IP addresses can access the status page.

  1. Restart Nginx:
    Once the configuration is complete, restart Nginx to apply the changes:
   sudo systemctl restart nginx
  1. Visit ‘stub_status’:
    Visit ‘http://your_server_ip/nginx_status’ in your browser and you should be able to see Nginx running status. Please make sure that your server IP address is replaced with ‘your_server_ip’.

While we’re at it, there’s a “status.conf” containing:

root@server /etc/nginx/conf.d # pwd
/etc/nginx/conf.d
root@server /etc/nginx/conf.d # cat status.conf
server {
        listen                  127.0.0.1:8084 default_server;
        server_name             _;
        server_name_in_redirect off;

        location / {
                stub_status on;
                access_log  off;
                error_log   /dev/null;
        }
}

What’s that for?

2nd question:
If we manually create an nginx configuration file in terminal within /etc/nginx/conf.d/ (instead of editing nginx configuration on the Web panel), would that be permanent, or it would disappear after a big update in HestiaCP?

This is the test, if there are errors you can update the instructions and submit the correct configuration scheme!

@yunli sorry? I did not get what you mean.