provides us a good way to the web  status using a module called stub_status_module. It is the same as “server-status” module used in the old Apache web server. With Nginx server status module you can gain useful information about your web server, such as:

  • Total requests
  • Requests per second
  • Number of connections
  • Number of reading, writing and waiting connections.

On most modern Nginx versions this status module comes already compiled, so you don’t need to do it manually. Anyway, you can check out if it is activated by running:

nginx -V

If you see “–with-http_stub_status_module”, then it’s ok. Once you ensure it’s activated, you can configure nginx status as you see below:

nano -w /etc/nginx/conf.d/status.conf

Place this code inside the server {} block

server {

    listen 80 default_server;
    access_log off;
    server_name _; 
    server_name_in_redirect off;

        location /nginx_status {
	        stub_status on;
	        access_log   off;
	        allow XX.XX.XX.XX;
	        deny all;


Replace “/var/www/html” with the document root of your real server, and XX.XX.XX.XX with your real address (in case you need protection, otherwise you can delete the allow/deny lines to allow access from everywhere).

Save the file and then reload Nginx to apply changes:

service nginx reload

Testing Nginx status module

curl http://XX.XX.XX.XX/nginx_status

You can also test this using your webserver using the same URL.

Nginx status monitor can work with graph tools such as or Rrdtool. On the next articles we will see how to integrate both things to have a better look of Nginx statistics.

Print Friendly, PDF & Email



Bài viết liên quan