Test the NGINX configuration files for errors before restarting NGINX?

Answered
nick asked this question 7 months ago
nick on Jan 13

My web application is being served by a NGINX web server.

After I make code changes to my NGINX configuration files, how do I verify they don't contain syntax errors before restarting the NGINX service?

Is there a simple command to do this?

2 suggested answers
itsbambi on Jan 13

Use the nginx -t command.

It tests your configuration file for any syntax errors.

If it doesn't return any errors, you're good to go!

0 replies
looper003 on Jan 13
sudo nginx -t
0 replies
Answered