nginx configtest vs nginx -t

While both of these commands will tell you if your new nginx configuration is ok [without killing your current instance]. Configtest uses the running service and tells you if it passes or fails the check whereas nginx -t will not only check the config but print any info, warning as well as error messages..

Usage is typically:

service nginx configtest && service nginx restart
or
nginx -t && service nginx restart

My personal preference is to use nginx -t becauseĀ 1. its shorter and i’m lazy snf 2. I like knowing where exactly the problem lies (easier debugging and whatnot).

You may also like...

Leave a Reply