Skip to content

Instantly share code, notes, and snippets.

@tvon

tvon/nginx-config-check

Last active Feb 21, 2016
Embed
What would you like to do?
#!/usr/bin/env bash
NGINX=/usr/sbin/nginx
DIRECTIVES="worker_processes 1; pid /var/run/nginx-${USER}.pid; error_log /dev/null;"
# nginx attempts to write to the default logfile location despite the passed directive, so grep those errors out
# (note that I may just be doing something stupid and not properly setting the directive)
$NGINX -t -c $1 -g "$DIRECTIVES" 2>&1 | grep -v '^nginx: '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment