70 likes | 100 Views
NGINX status page allows you to monitor NGINX web server health. Here's how to enable NGINX status page for your website. #nginx #webdevelopment <br>Visit https://ubiq.co/tech-blog/how-to-enable-nginx-status-page/
E N D
Check if NGINX status page is enabled Most NGINX distributions come with ngx_http_stub_status_module module enabled. You can check if it is enabled in your NGINX installation using the following command # nginx -V 2>&1 | grep -o with-http_stub_status_module --with-http_stub_status_module If you see –with-http_stub_status_module output, it means the status module is already enabled.
Enable status page We will enable NGINX status page by setting up a URL (e.g /status_page) for status page. For this, add a location block in NGINX server configuration as shown below. Open terminal and run the following command to open NGINX server configuration file. $ sudo vi /etc/nginx/nginx.conf If you have configured separate virtual hosts for your website (e.g www.example.com), such as /etc/nginx/sites-enabled/website.conf then open its configuration with the following command $ sudo vi /etc/nginx/sites-enabled/website.conf Add the following location block that will enable stub_status module location /nginx_status { stub_status; allow 127.0.0.1; #only allow requests from localhost deny all; #deny all other hosts }
Enable HTTPS in firewall By default, HTTP port 80 and HTTPS port 443 are blocked in CentOS. Run the following command to open it to allow HTTP and HTTPS traffic. $ sudo firewall-cmd --permanent --add-service=http --add-service=https Reload firewall to apply changes $ sudo firewall-cmd --reload
Restart NGINX Server Run the following command to check syntax of your updated config file. $ sudo nginx -t If there are no errors, run the following command to restart NGINX server. $ sudo service nginx reload #debian/ubuntu $ systemctl restart nginx #redhat/centos
Test NGINX Status Page Run the following command to visit your status page URL using curl command. Replace 127.0.0.1 with your server IP or domain name # curl http://127.0.0.1/nginx_status OR # curl http://www.example.com/nginx_status
Thank You Visit for details https://ubiq.co/tech-blog/how-to-enable-nginx-status-page/