projects@yorhel.nl
home - git - @ayo
= pgp = only used for releases
key - mit
7446 0D32 B808 10EB A9AF A2E9 6239 4C69 8C27 39FA

Cute decorative scissors, cutting through your code.

Nginx Configuration Generator

nginx-confgen is a simple preprocessor and macro system for nginx and nginx-like configuration files. It support variable substitution, macro expansion and using the output of arbitrary commands to generate config files.

Example

pre_set $certdir /etc/nginx-certificates/;

# Fetch the 'resolver' from /etc/resolv.conf
pre_exec $nameserver "grep nameserver /etc/resolv.conf \\
                      | head -n 1 | sed 's/^nameserver //'";
resolver $nameserver;

# Convenient macro to create a HTTPS virtual host
macro vhost $domain @aliases &block {
  server {
    listen [::]:443 ssl;
    server_name $domain @aliases;

    ssl_certificate     $certdir/$domain/fullchain.pem;
    ssl_certificate_key $certdir/$domain/privkey.pem;
    pre_if -f $certdir/$domain/ocsp.der {
      ssl_stapling_file $certdir/$domain/ocsp.der;
    }

    █
  }
}

vhost example.com www.example.com {
  root /var/www/example.com;
}

See the manual for more features.

Download

Latest version Atom feed
2.1 (File: nginx-confgen-2.1.tar.gz
Size: 17.0 KiB (17.363 bytes)
PGP: nginx-confgen-2.1.tar.gz.asc
MD5: add2266c457f4872d0fdfa9054352051
SHA1: 2c47e9eb00f14fb3d5f602e47c29faedb2fd6e37
SHA-256: 50989fd0be90cc3493dd3081d8010d1bea036dcf9c5904fb989387352879f539
nginx-confgen-2.1.tar.gz
- changes)
Requirements
A C compiler and a UNIX-like system. Only tested on Linux, but should also work on *BSD and MacOS (patches welcome if this is not the case).
License
MIT
Distribution packages
nginx-confgen is available in Debian.
Development version

git clone https://code.blicky.net/yorhel/nginx-confgen.git

The git repository is also available for online browsing.