To enable the Nginx status page, you need to add a location block to your Nginx configuration file that will return information about the status of Nginx.
Here’s an example of how you can enable the Nginx status page:
- Open the Nginx configuration file in your preferred text editor:
sudo nano /etc/nginx/nginx.conf
- Add the following location block to the Nginx configuration file:
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
- Save the changes to the Nginx configuration file and close the text editor.
- Test the Nginx configuration for syntax errors:
sudo nginx -t
- If the test returns no errors, reload the Nginx configuration:
sudo systemctl reload nginx
- Verify that the Nginx status page is working by accessing it in a web browser. The URL to access the Nginx status page is
http://your-server-ip/nginx_status
.
This will enable the Nginx status page, which provides information about the current status of Nginx, including the number of active connections, the number of requests processed, and the amount of traffic processed. The status page is useful for monitoring the performance and health of your Nginx server.