How to test and debug NGINX configuration?

nginx configuration debug

While configuration can be tested with command service nginx configtest, there is a more convenient way to do this - and immediately get whats wrong. 

There is a command nginx -t, which test configuration and display error messages. Both commands must be used with sudo or permission denied messages might be shown (regarding SSL certificates for example).

Command to test and reload if it's ok:

sudo nginx -t && sudo service nginx reload