Categories
Linux

Production: How to check and fix nginx errors before deployment

I will show a simple tip to test nginx configuration on live site ( production server ) before deployment.

This is especially useful for server serving many different sites. A little mis-configuration, even a missed comma, can instantly bring down hundreds or even thousands of sites. So you should test it first:

sudo service nginx configtest

If it fails then you can find the cause of failure at:

tail /var/log/nginx/error.log

Fix it (verify using configtest as above and then run as usual:

sudo service nginx reload

nginx, currently at 33% market share, is a very popular web server.