Skip to content

Instantly share code, notes, and snippets.

@wpsmithtwc
Forked from psd/validate_conf.sh
Created March 28, 2016 19:26
Show Gist options
  • Save wpsmithtwc/ab6a25f745093e23c275 to your computer and use it in GitHub Desktop.
Save wpsmithtwc/ab6a25f745093e23c275 to your computer and use it in GitHub Desktop.
use nginx to validate config
#!/bin/bash
#
# validate nginx config
#
# depends upon a symbolic link from /var/apps/redirector to dist directory
# and a build of nginx which supports real_ip and other extensions
#
# probably best to build a chroot'd tree containing a complete nginx server
# though that's a lot of work to copy in shared libraries, etc
#
mkdir -p tmp
conf=$PWD/tmp/test-nginx.conf
cat > $conf <<-!
http {
include $PWD/dist/configs/*.conf;
}
!
PATH=/usr/sbin:/usr/local/sbin nginx -t -c $conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment