He is a Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!
Hi All, this document deals with how to monitor nginx active connections.
Nginx is one of the best open source web servers. It performs much faster than the Apache web server.
Nginx is a web server which can also be used as a reverse proxy, load balancer, mail proxy, and HTTP cache. The software was created by Igor Sysoev and first publicly released in 2004. A company of the same name was founded in 2011 to provide support and Nginx plus paid software.
So here is the configuration to see the connections detail of Nginx server
Step1: Open the Nginx configuration. In my case it is /etc/nginx/conf/nginx.conf.
For you it might be in /etc/nginx/sites-available/default.conf
Step 2: Add the following into the server block.
where /nginx_status is the URL path to see the connection details.
allow <IP> is the IP from which Nginx allows to see the connection details page.
deny all refer to deny all the request for this path other than the allowed IP address.
Step 3: Once the configuration is done, save and exit.
Step 4: Check the configuration using the below command
Expected Output.
nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /opt/nginx/conf/nginx.conf test is successful
Step 5: Restart or reload the Nginx service.
If you want to Nginx connection status page to be running in a different port, use the below configuration.
Step 1: Create a new server block which runs on different port number. OR you can create a file with configuration under /etc/nginx/sites-available/
}
Step 2: Check the configuration using the below command
Expected Output.
Step 3: Restart or reload the Nginx service.
© 2019, Techrunnr. All rights reserved.