Server Monitoring2 min read

    How to Monitor Nginx Web Server

    By Dana— Server Monitoring & Linux
    Share

    Overview

    The Nginx integration lets you monitor your Nginx web server performance in real time using the stub_status module. Xitoring collects connection states, request rates, and throughput metrics — giving you deep visibility into how Nginx handles traffic on your servers.

    What Can It Monitor?

    The Nginx integration tracks the following metrics:

    • Active Connections — Number of currently active client connections, including waiting
    • Accepted Connections — Total accepted client connections since server start
    • Handled Connections — Total handled connections (equals accepts unless resource limits are hit)
    • Reading — Connections where Nginx is reading the request header
    • Writing — Connections where Nginx is writing the response back to the client
    • Waiting — Keep-alive connections waiting for the next request
    • Requests per Second — Rate of incoming requests
    • Connections per Second — Rate of new connections being accepted

    Prerequisites

    You need to ensure that the stub_status module is available in your Nginx installation.

    On Linux

    Check for the module:

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

    On Windows

    Navigate to your Nginx directory (typically C:\nginx) and run:

    nginx -V 2>&1 | findstr /C:"http_stub_status_module"
    

    Configure Nginx

    Add the following location block to your Nginx server configuration:

    location /nginx-status {
        stub_status;
        access_log off;
        server_tokens on;
        allow 127.0.0.1;
        deny all;
    }
    

    This serves statistics at http://127.0.0.1/nginx-status only on localhost, keeping them secure from public access.

    Reload Nginx after making changes:

    sudo nginx -s reload
    

    How to Activate the Integration

    Prefer the panel? You don't need the CLI for this step. In Xitoring, open the server, go to Integrations, choose Nginx, fill in the same details, and click Enable. See enabling integrations from the Xitoring panel. The CLI steps below still work if you script your setup.

    Once stub_status is configured, activate the integration via the Xitogent CLI:

    xitogent integrate
    

    Select Nginx from the list of available integrations. When prompted, enter the URL where Nginx serves its status page:

    http://127.0.0.1/nginx-status
    

    If successful, you'll see:

    connection established
    integration setup was successful and the config file updated
    

    The config file is created at /etc/xitogent/integrations/nginx_integration.conf.

    Setting Up Triggers

    You can create triggers for the following parameters to get incidents when values exceed or drop below your thresholds:

    • Active Connections
    • Accepted Connections
    • Handled Connections
    • Reading / Writing / Waiting
    • Requests per Second

    Navigate to Triggers on your server page, select Nginx as the integration, choose a metric, set the threshold value, and configure notifications.

    Tips

    • Always restrict the status endpoint to 127.0.0.1 for security
    • Monitor Active Connections to detect traffic surges early
    • Watch the gap between Accepted and Handled — a growing difference indicates resource exhaustion
    • Use Waiting connection alerts to identify slow backends or keep-alive issues
    • Works on both Linux and Windows servers