This is a small post on how to start troubleshooting Nginx server. If you are facing an issue with nginx or any server/service the first thing to conform is if our configurations are correct or not. Nginx have two commands to show if there is any issue with your configuration or not.

Checking your configs with service command

	service nginx configtest

For a failed test you will get below output:

	[email protected]:/etc/nginx# service nginx configtest
 * Testing nginx configuration                                                                                                           [fail]

If you observe the above command, it is giving some hint about configuration error but it is not giving more information what error it is.

Test your configurations with nginx command to get more information about what error you have in your configuraton.

	nginx -t

-t is for testing your configuraton


	[email protected]:/etc/nginx# nginx -t
nginx: [emerg] unexpected "}" in /etc/nginx/sites-enabled/
nginx: configuration file /etc/nginx/nginx.conf test failed

From the above message we can see there is an error in 37 line.

Related concept:   Unconfiguring RAID0

If you don't find any issue with your nginx config then our next stop is at logs which are important source of information on what is happening with that server. By default nginx logs are located in /var/log/nginx, but if they are not located there don’t be panic. We have to check nginx configuration file /etc/nginx/nginx.conf for exact log file location. To know your log file entries just search for below words in /etc/nginx/nginx.conf file.

	 access_log or error_log

Once you are able to find logs from there we can see what happening at server and take nessary stops to make our nginx server working.

Want to check configurations settings for other service then have a look at our post on "Linux/Unix:Server configuration file syntax Checking commands"