Skip to content

Instantly share code, notes, and snippets.

@psd
Last active January 25, 2024 19:13
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save psd/5042334 to your computer and use it in GitHub Desktop.
Save psd/5042334 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