Test the NGINX configuration files for errors before restarting NGINX?

Answered
nick asked this question 12 days ago
nick 12 days ago

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 12 days ago

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 12 days ago
sudo nginx -t
0 replies
Answered