Like Aapache (httpd), nginx has status page to give you information about Nginx's server health including Active connections and other data. You can use this info to fine tune your server. Please note that you will get stats for entire Nginx server running. This can not be used to get info per virtual host i.e. you will get data for entire Nginx server only.
Make sure HttpStubStatusModule compiled
Type the following command to verify that HttpStubStatusModule is compiled and available to you:
nginx -V | grep --color -o http_stub_status
Enable Nginx status page on Linux/Unix
Edit nginx.conf, enter:
Update your server { ..... } block/context as follows (see how to deny access to IP address on nginx):
# vi nginx.conf
Update your server { ..... } block/context as follows (see how to deny access to IP address on nginx):
location /nginx_status { # Turn on nginx stats stub_status on; # I do not need logs for stats access_log off; # Security: Only allow access from 192.168.1.100 IP # allow 192.168.1.100; # Send rest of the world to /dev/null # deny all; }
Feel free to replace 192.168.1.100 with your actual IP address. This is a security feature as you do not want to show your status to the whole world.
Restart / reload nginx server
Type the following command to reload nginx:
OR
# service nginx reload
OR
# nginx -s reload
How do I view nginx status page?
Fire a browser and type the url:
Sample outputs:
example.com/nginx_status
1.2.3.4/nginx_status
www.cyberciti.biz/nginx_status
Sample outputs:
0 comments:
Post a Comment