nginx is a high performance HTTP and mail proxy server written by Igor Sysoev.

I’m not sure what the init scripts do for other distros but it seems a bit of an oversight to leave out checking the config file when running the init script.

Add this line to your nginx init script right after the text -x $DAEMON line to make it check the config before proceeding to start stop or restart the service.

$DAEMON -t > /dev/null 2>&1 
if [ $? -ne 0 ]; then
        echo "Configuration file has errors, try $DAEMON -t"
        exit 0