Nginx web server can fail to start if the configuration file contains errors. If any changes were made in a configuration file, it is recommended to check whether syntax is correct before restarting Nginx. This tutorial explains how to check errors in Nginx configuration file on Ubuntu.
To test the Nginx configuration file, run the following command:
sudo nginx -t
The command prints
syntax is ok or information about the particular syntax error.