Это - потому что это действительно прибывает из localhost - это - Apache, говорящий с собой.
There's no easy answer here. Unfortunately, if you pipe the output of the syntax check to something like logger, you lose the return code to check if it failed.. so you have to do it something like this:
syntax_check_output=`mktemp /tmp/nginx.check.XXXXXX`
if $DAEMON -t -c $NGINX_CONF_FILE > $syntax_check_output 2>&1 ; then
rm -f $syntax_check_output
else
logger -t nginx -p daemon.err < $syntax_check_output
rm -f $syntax_check_output
exit 1
fi
(incidentally, you should note that all upstart script sections are run with 'set -e', so the if statement in your original example won't be executed.. as soon as the command exits non-zero, the shell will exit.)