Decision-making in NGINX

You may find yourself trying to bend NGINX's configuration directives in ways that they were not meant to be used. This is frequently seen in configurations where there are a lot of if checks to try to emulate some sort of logic chain. A better option would be to use NGINX's embedded perl module. With this module, you will be able to use the flexibility of Perl to achieve your configuration goals.

The perl module is not built by default, so it needs to be enabled with the --with-http_perl_module configure switch. A minimum of Perl 5.6.1 is required. Ensure as well that your Perl was built with -Dusemultiplicity=yes (or -Dusethreads=yes) and -Dusemymalloc=no. NGINX configuration reloads will cause the perl module to leak ...

Get Mastering NGINX - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.