vhost_traffic_status_display

The `vhost_traffic_status_display` directive enables the display of traffic status for virtual hosts in NGINX.

Syntaxvhost_traffic_status_display;
Defaultnone
Contextserver, location
Argumentsnone

Description

The vhost_traffic_status_display directive is part of the NGINX Virtual Host Traffic Status module and is used to enable or disable the display of traffic statistics for virtual hosts. This directive can be placed within either the server or location context of an NGINX configuration. When enabled, it allows users to request traffic status information via specific URIs, typically used for monitoring and analyzing traffic patterns on a web server level.

The directive does not take any arguments, and it effectively activates the handler responsible for processing such display requests. The related handler ensures that information is gathered from shared memory zones designated for traffic statistics, and it allows for different types of responses, including JSON or HTML format depending on the configuration. The display handler can also manage control commands, enabling functionalities such as resetting or deleting statistics on the fly, providing richer interactivity in monitoring scenarios.

It is important to configure the shared memory zone with proper access permissions and ensure that the traffic status collection is enabled for the desired objects, otherwise, the display output may not function or show incomplete data. By utilizing this directive, administrators can gain valuable insights into request counts, data transfer rates, and response statuses for virtual hosts, greatly aiding performance tuning and resource management.

Config Example

server {
    listen 80;
    server_name example.com;
    location /status {
        vhost_traffic_status_display;
    }
}

Ensure that the shared memory zone is properly configured and assigned; without it, the display will not function as intended.

This directive does not take any parameters, so configurations such as vhost_traffic_status_display on; are incorrect and will cause errors.

If the request method is not GET or HEAD, the display will return a 405 Method Not Allowed error.

← Back to all directives