nginx: See Active connections / Connections Per Seconds

‮.www‬lautturi.com
nginx: See Active connections / Connections Per Seconds

To see the active connections and connections per second for an Nginx web server, you can use the nginx status module. This module provides a status page that shows real-time information about the server's performance, including the number of active connections and the rate at which connections are being accepted.

To enable the nginx status module, you will need to add the status directive to the http block in your Nginx configuration file, and then create a location block to define the URL that will be used to access the status page.

Here's an example of how you can enable the nginx status module and create a location block to access the status page:

http {
    server_tokens off;
    server_name _;
    listen 80;

    # Enable the nginx status module
    status;

    # Create a location block for the status page
    location /nginx_status {
        # Allow access to the status page from any IP address
        allow all;
        # Deny access to the status page from any IP address that does not have permission
        deny all;
        # Display the status page when the URL is accessed
        stub_status on;
    }
}

In this example, the status directive enables the nginx status module. The location block defines a URL called /nginx_status that can be used to access the status page. The allow and deny directives in the location block allow access to the status page from any IP address, while denying access to any IP address that does not have permission. The stub_status on directive enables the display of the status page when the URL is accessed.

Once you have added these directives to your Nginx configuration file, you can access the status page by visiting http://your-server-name/nginx_status in a web browser. The status page will show the number of active connections and the rate at which connections are being accepted, as well as other information about the server's performance.

For more information on the nginx status module and the status, allow, deny, and stub_status directives, you can refer to the Nginx documentation.

Created Time:2017-10-30 10:17:56  Author:lautturi