Skip to content

Instantly share code, notes, and snippets.

@Voronenko
Created July 21, 2018 17:35
Show Gist options
  • Save Voronenko/44f11d562c87427da4cd732bedabb54c to your computer and use it in GitHub Desktop.
Save Voronenko/44f11d562c87427da4cd732bedabb54c to your computer and use it in GitHub Desktop.
Validates test config
#!/bin/bash
#
# validate nginx config
#
# based on script by Paul Downey
# https://gist.github.com/psd/5042334
test_conf=`mktemp`
target_conf=$1
cat > $test_conf <<-!
events {
worker_connections 512;
}
http {
include $target_conf;
}
!
PATH=/usr/sbin:/usr/local/sbin nginx -t -c $test_conf
rc=$?
rm "$test_conf"
exit $rc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment