diff -Nru nginx-1.18.0/debian/apport/source_nginx.py nginx-1.18.0/debian/apport/source_nginx.py --- nginx-1.18.0/debian/apport/source_nginx.py 1970-01-01 00:00:00.000000000 +0000 +++ nginx-1.18.0/debian/apport/source_nginx.py 2020-08-25 14:11:14.000000000 +0000 @@ -0,0 +1,19 @@ +''' +apport package hook for nginx packages + +Copyright (c) 2015, Thomas Ward +''' + +import apport.hookutils +import os +import subprocess + +def add_info(report, ui): + if (report['Package'].split()[0] != 'nginx-common' + and report['ProblemType'] == 'Package' + and os.path.isdir('/run/systemd/system')): + report['Journalctl_Nginx.txt'] = apport.hookutils.command_output( + ['journalctl', '-xe', '--unit=nginx.service']) + report['SystemctlStatusFull_Nginx.txt'] = subprocess.Popen( + ['systemctl', '-l', 'status', 'nginx.service'], + stdout=subprocess.PIPE).communicate()[0] diff -Nru nginx-1.18.0/debian/changelog nginx-1.18.0/debian/changelog --- nginx-1.18.0/debian/changelog 2020-08-19 13:27:02.000000000 +0000 +++ nginx-1.18.0/debian/changelog 2022-02-16 17:10:20.000000000 +0000 @@ -1,3 +1,142 @@ +nginx (1.18.0-6ubuntu14) jammy; urgency=medium + + * No-change rebuild to update maintainer scripts, see LP: 1959054 + + -- Dave Jones Wed, 16 Feb 2022 17:10:20 +0000 + +nginx (1.18.0-6ubuntu13) jammy; urgency=medium + + * No-change rebuild for the perl update. + + -- Matthias Klose Sun, 06 Feb 2022 13:48:12 +0100 + +nginx (1.18.0-6ubuntu12) jammy; urgency=medium + + * No-change rebuild against openssl3 + + -- Simon Chopin Wed, 24 Nov 2021 13:59:50 +0000 + +nginx (1.18.0-6ubuntu11) impish; urgency=medium + + * No-change rebuild to build packages with zstd compression. + + -- Matthias Klose Thu, 07 Oct 2021 12:21:36 +0200 + +nginx (1.18.0-6ubuntu10) impish; urgency=medium + + * SECURITY UPDATE: DNS Resolver issues + - debian/patches/CVE-2021-23017-1.patch: fixed off-by-one write in + src/core/ngx_resolver.c. + - debian/patches/CVE-2021-23017-2.patch: fixed off-by-one read in + src/core/ngx_resolver.c. + - debian/patches/CVE-2021-23017.patch: removed, replaced with upstream + commits. + - CVE-2021-23017 + + -- Marc Deslauriers Wed, 26 May 2021 06:59:42 -0400 + +nginx (1.18.0-6ubuntu9) impish; urgency=medium + + * SECURITY UPDATE: DNS Resolver Off-by-One Heap Write + - debian/patches/CVE-2021-23017.patch: fix logic in + src/core/ngx_resolver.c. + - CVE-2021-23017 + + -- Marc Deslauriers Tue, 25 May 2021 13:06:54 -0400 + +nginx (1.18.0-6ubuntu8) hirsute; urgency=medium + + * d/modules/control: Remove Lua module from definitions + * d/tests/: + - control: Remove Lua test, remove dependencies on any test which + request libnginx-mod-http-lua as it's gone. + - lua: Remove the lua test entirely. + + -- Thomas Ward Wed, 10 Mar 2021 10:50:43 -0500 + +nginx (1.18.0-6ubuntu7) hirsute; urgency=medium + + * d/control: + - Fix dependencies issue for libnginx-mod-http-geoip2 - missing a + character in the depends. + + -- Thomas Ward Tue, 09 Mar 2021 19:03:55 -0500 + +nginx (1.18.0-6ubuntu6) hirsute; urgency=medium + + * d/control: + - Update dependencies for nginx-light, etc. to include + libnginx-mod-http-geoip2 as it's in the 'common build flags' for + all flavors of the builds. + - Update nginx-core package description to list third party HTTP + modules. GeoIP2 is not included for Stream by default, so we + have to adjust this because the Stream part isn't MIR'd. + + -- Thomas Ward Tue, 09 Mar 2021 12:41:36 -0500 + +nginx (1.18.0-6ubuntu5) hirsute; urgency=medium + + * d/control: (GeoIP2 related changes) + - Update dependencies for http-geoip2 package. + - Update nginx-core to include http-geoip2 module due to approved bin-MIR + (LP: #1867198) + - Update description to nginx-core to indicate geoip2 is included. + * d/control: move geoip2 module build flags to the common flags so all + package flavors have it. + * d/modules/http-geoip2: Update to upstream version 3.3. + * Remove the Lua modules from NGINX (Server Team Decision) - future support + for Lua module now requires resty-core from OpenResty, meaning that if + we want to continue to support the Lua module, we have to start becoming + OpenResty - users should just use OpenResty at this point for Lua. + Changes made for this removal: + - d/control: + - Remove lua module from dependencies, and binary build item. + - Add "Breaks" line for nginx-lua for older versions of NGINX. + This is added to the nginx metapackage and nginx-extras. + - d/copyright: Remove lua module. + - d/modules/{,patches/,watch/}nginx-lua: Remove Lua module, watch file, + module patches. + - d/rules: Remove Lua module from the build flags for -extras. + + -- Thomas Ward Mon, 08 Mar 2021 09:59:56 -0500 + +nginx (1.18.0-6ubuntu4) hirsute; urgency=medium + + * No-change rebuild for the perl update. + + -- Matthias Klose Mon, 09 Nov 2020 12:46:47 +0100 + +nginx (1.18.0-6ubuntu3) hirsute; urgency=medium + + * No-change rebuild for the perl update. + + -- Matthias Klose Mon, 09 Nov 2020 10:51:27 +0100 + +nginx (1.18.0-6ubuntu2) groovy; urgency=medium + + * d/control: make nginx and nginx-full arch any, so that nginx-full + is no longer pulled into main because of i386 (LP: #1893267) + + -- Andreas Hasenack Thu, 27 Aug 2020 16:59:57 -0300 + +nginx (1.18.0-6ubuntu1) groovy; urgency=medium + + * Merge with Debian unstable. Remaining changes: + - d/p/ubuntu-branding.patch: add Ubuntu branding + - d/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - d/nginx-common.install: Add install rule for apport hooks. + - d/p/nginx-fix-pidfile.patch: Fix NGINX PIDfile handling to avoid + SystemD race condition - thanks to Tj for the patch. (LP #1581864) + - d/control: drop GeoIP from nginx-core due to demotion of libgeoip + (LP #1861101, LP #1867150): + + remove libnginx-mod-http-geoip from nginx-core dependency + + have nginx-core depend on libnginx-mod-stream-geoip2 + instead of libnginx-mod-stream-geoip + + adjust package descriptions accordingly + + -- Andreas Hasenack Tue, 25 Aug 2020 11:11:41 -0300 + nginx (1.18.0-6) unstable; urgency=medium * Fix GCC-10 compatibility (Closes: #957605). @@ -22,6 +161,69 @@ -- Ondřej Nový Fri, 03 Jul 2020 09:34:49 +0200 +nginx (1.18.0-3ubuntu2) groovy; urgency=medium + + * Re-apply demotion of geoip in favor of geoip2 + - Fixes some accidentally dropped delta from merge to fix + unsatisfiable depends. nginx-[core|full] need to depend on + libnginx-mod-stream-geoip2, not on -geoip. + (LP #1861101) + + -- Bryce Harrington Mon, 06 Jul 2020 15:12:26 -0700 + +nginx (1.18.0-3ubuntu1) groovy; urgency=medium + + * Merge with Debian unstable. Remaining changes: + - d/p/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - d/nginx-common.install: Add install rule for apport hooks. + - d/p/nginx-fix-pidfile.patch: Fix NGINX PIDfile handling to avoid + SystemD race condition - thanks to Tj for the patch. (LP #1581864) + - Drop GeoIP from nginx-core due to demotion of libgeoip + (LP #1861101, LP #1867150): + + d/control: Remove libnginx-mod-http-geoip from nginx-core dependency + + d/rules: Remove the configure line of with-http_geoip_module=dynamic + from the nginx-core build flags, due to demotion of libgeoip and the + removal of the dynamic library from install deps for nginx-core. + * d/a/source_nginx.py: Fix indentation in apport hook + * d/p/nginx-fix-pidfile.patch: Update dep3 with fwd debian link + * Dropped: + - debian/patches/0002-Make-sure-signature-stays-the-same-in- + all-nginx-buil.patch: Refreshed patch - Merge-o-Matic introduced some + fuzz which caused issues. + [ Does not seem necessary ] + - d/control: drop mention of SSL Preread from nginx-full, nginx-extras + [ Previously undocumented ] + - d/gbp.conf: update for 1.12 release + [ Previously undocumented ] + - d/p/0003-define_gnu_source-on-other-glibc-based-platforms.patch: + Refresh patch. + [ Previously undocumented ] + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - Add GeoIP2 third party module to nginx-full and nginx-extras + (LP #1825895). The following is the files list for this: + + d/{control,rules}: Add libnginx-mod-http-geoip2 and corresponding + build rules. + + d/modules/http-geoip2{,/*}: Add geoip2 module from third party git. + + d/copyright: Add relevant copyright lines for GeoIP2 module. + - d/conf/sites-available/default: Update PHP path for PHP 7.4. + [added in 1.17.9-0ubuntu3 taken by Debian in 1.18.0-2] + - d/nginx-full.postinst: Add checks for whether + port 80 is in use or not to determine whether or not to attempt + starting of the NGINX service during install/upgrade. + - d/control: Add dependency from nginx-full on `iproute2` as the + postinst scripts now use `ss` to determine if Port 80 is open + or not. + [Taken by Debian in 1.18.0-2] + - d/rules: Enable --with-compat build option for all nginx package + flavors (LP #1797897) + + -- Bryce Harrington Wed, 24 Jun 2020 23:15:11 +0000 + nginx (1.18.0-3) unstable; urgency=medium * Source-only upload to allow migration. @@ -79,6 +281,225 @@ -- Ondřej Nový Fri, 29 May 2020 19:03:30 +0200 +nginx (1.17.10-0ubuntu1) focal; urgency=medium + + * New upstream release (1.17.9) - full changelog available from + http://nginx.org/en/CHANGES + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - d/nginx-{core,light,full,extras}.postinst: Add checks for whether + port 80 is in use or not to determine whether or not to attempt + starting of the NGINX service during install/upgrade + - d/control: Add dependencies to nginx-{core,light,full,extras} on + `iproute2` as the postinst scripts now use `ss` to determine if + Port 80 is open or not. + - d/rules: Enable --with-compat build option for all nginx package + flavors + - d/{control,rules,copyright,modules/http-geoip2*}: Add GeoIP2 third party + module to nginx-full and nginx-extras (and use proper DEP5 syntax for + d/copyright). + - d/control, d/rules: Drop GeoIP from nginx-core due to demotion of + libgeoip. + + -- Thomas Ward Tue, 14 Apr 2020 12:53:34 -0400 + +nginx (1.17.9-0ubuntu3) focal; urgency=medium + + * d/conf/sites-available/default: Update PHP path for PHP 7.4. + + -- Thomas Ward Thu, 26 Mar 2020 10:53:52 -0400 + +nginx (1.17.9-0ubuntu2) focal; urgency=medium + + * Drop GeoIP from nginx-core due to demotion of libgeoip (LP: #1861101, + LP: #1867150): + - d/control: Remove libnginx-mod-http-geoip from nginx-core dependency + - d/rules: Remove the configure line of with-http_geoip_module=dynamic + from the nginx-core build flags, due to demotion of libgeoip and the + removal of the dynamic library from install deps for nginx-core. + + -- Thomas Ward Wed, 11 Mar 2020 13:41:07 -0400 + +nginx (1.17.9-0ubuntu1) focal; urgency=medium + + * New upstream release (1.17.9) - full changelog available from + http://nginx.org/en/CHANGES + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - d/nginx-{core,light,full,extras}.postinst: Add checks for whether + port 80 is in use or not to determine whether or not to attempt + starting of the NGINX service during install/upgrade + - d/control: Add dependencies to nginx-{core,light,full,extras} on + `iproute2` as the postinst scripts now use `ss` to determine if + Port 80 is open or not. + - d/rules: Enable --with-compat build option for all nginx package + flavors + - d/{control,rules,copyright,modules/http-geoip2*}: Add GeoIP2 third party + module to nginx-full and nginx-extras (and use proper DEP5 syntax for + d/copyright). + + -- Thomas Ward Tue, 03 Mar 2020 11:05:45 -0500 + +nginx (1.17.8-0ubuntu3) focal; urgency=medium + + * d/conf/sites-available/default: Indentation consistency. + Fix an indentation issue introduced by 1.17.8-0ubuntu2 to make sure that + indentation in the default config file is consistent. + + -- Thomas Ward Wed, 26 Feb 2020 10:35:13 -0500 + +nginx (1.17.8-0ubuntu2) focal; urgency=medium + + * d/conf/sites-available/default: Revert changes done in #1743592. + Reverts this change: + - d/conf/sites-available/default: Update default nginx site + configuration file to remove the IPv6 listening line so that servers + running without IPv6 enabled at all on the system will start nginx + properly. + + -- Thomas Ward Thu, 20 Feb 2020 13:52:32 -0500 + +nginx (1.17.8-0ubuntu1) focal; urgency=medium + + * New upstream release (1.17.8) - full changelog available from + http://nginx.org/en/CHANGES + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - d/nginx-{core,light,full,extras}.postinst: Add checks for whether + port 80 is in use or not to determine whether or not to attempt + starting of the NGINX service during install/upgrade + - d/control: Add dependencies to nginx-{core,light,full,extras} on + `iproute2` as the postinst scripts now use `ss` to determine if + Port 80 is open or not. + - d/rules: Enable --with-compat build option for all nginx package + flavors + - d/{control,rules,copyright,modules/http-geoip2*}: Add GeoIP2 third party + module to nginx-full and nginx-extras (and use proper DEP5 syntax for + d/copyright). + - d/conf/sites-available/default: Update default nginx site configuration + file to remove the IPv6 listening line so that servers running without + IPv6 enabled at all on the system will start nginx properly. + (LP: #1743592) + + -- Thomas Ward Tue, 18 Feb 2020 19:01:02 -0500 + +nginx (1.17.7-0ubuntu1) focal; urgency=medium + + * New upstream release (1.17.7) - full changelog available from + http://nginx.org/en/CHANGES + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - d/nginx-{core,light,full,extras}.postinst: Add checks for whether + port 80 is in use or not to determine whether or not to attempt + starting of the NGINX service during install/upgrade + - d/control: Add dependencies to nginx-{core,light,full,extras} on + `iproute2` as the postinst scripts now use `ss` to determine if + Port 80 is open or not. + - d/rules: Enable --with-compat build option for all nginx package + flavors + - d/{control,rules,copyright,modules/http-geoip2*}: Add GeoIP2 third party + module to nginx-full and nginx-extras (and use proper DEP5 syntax for + d/copyright). + - d/conf/sites-available/default: Update default nginx site configuration + file to remove the IPv6 listening line so that servers running without + IPv6 enabled at all on the system will start nginx properly. + (LP: #1743592) + + + -- Thomas Ward Mon, 30 Dec 2019 13:02:58 -0500 + +nginx (1.17.6-0ubuntu1) focal; urgency=medium + + * New upstream release (1.17.6) - full changelog available from + http://nginx.org/en/CHANGES + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - d/nginx-{core,light,full,extras}.postinst: Add checks for whether + port 80 is in use or not to determine whether or not to attempt + starting of the NGINX service during install/upgrade + - d/control: Add dependencies to nginx-{core,light,full,extras} on + `iproute2` as the postinst scripts now use `ss` to determine if + Port 80 is open or not. + - d/rules: Enable --with-compat build option for all nginx package + flavors + - d/{control,rules,copyright,modules/http-geoip2*}: Add GeoIP2 third party + module to nginx-full and nginx-extras (and use proper DEP5 syntax for + d/copyright). + - d/conf/sites-available/default: Update default nginx site configuration + file to remove the IPv6 listening line so that servers running without + IPv6 enabled at all on the system will start nginx properly. + (LP: #1743592) + + + -- Thomas Ward Tue, 19 Nov 2019 10:34:14 -0500 + +nginx (1.17.5-0ubuntu1) focal; urgency=medium + + * New upstream release (1.17.5) - full changelog available from + http://nginx.org/en/CHANGES + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - d/nginx-{core,light,full,extras}.postinst: Add checks for whether + port 80 is in use or not to determine whether or not to attempt + starting of the NGINX service during install/upgrade + - d/control: Add dependencies to nginx-{core,light,full,extras} on + `iproute2` as the postinst scripts now use `ss` to determine if + Port 80 is open or not. + - d/rules: Enable --with-compat build option for all nginx package + flavors + - d/{control,rules,copyright,modules/http-geoip2*}: Add GeoIP2 third party + module to nginx-full and nginx-extras (and use proper DEP5 syntax for + d/copyright). + * New Ubuntu-specific changes: + - d/conf/sites-available/default: Update default nginx site configuration + file to remove the IPv6 listening line so that servers running without + IPv6 enabled at all on the system will start nginx properly. + (LP: #1743592) + + -- Thomas Ward Fri, 01 Nov 2019 11:55:10 -0400 + nginx (1.16.1-3) unstable; urgency=high * Handle CVE-2019-20372, error page request smuggling @@ -103,6 +524,294 @@ -- Christos Trochalakis Mon, 09 Sep 2019 18:24:43 +0300 +nginx (1.16.1-0ubuntu3) focal; urgency=medium + + * No-change rebuild for the perl update. + + -- Matthias Klose Fri, 18 Oct 2019 19:37:10 +0000 + +nginx (1.16.1-0ubuntu2) eoan; urgency=medium + + * d/conf/sites-available/default: Update PHP referred to in the + example in the default configuration to PHP 7.2. + (LP: #1831748) + + -- Thomas Ward Thu, 15 Aug 2019 12:01:39 -0400 + +nginx (1.16.1-0ubuntu1) eoan; urgency=medium + + * New upstream release (1.16.1) - full changelog available from + http://nginx.org/en/CHANGES-1.16 + * This patch contains security patches only. + * Security content in this version: + - When using HTTP/2 a client might cause excessive memory consumption + and CPU usage (CVE-2019-9511. CVE-2019-9513, CVE-2019-9516) + + -- Thomas Ward Tue, 13 Aug 2019 13:08:03 -0400 + +nginx (1.16.0-0ubuntu2) eoan; urgency=medium + + * d/patches/nginx-fix-pidfile.patch: Fix NGINX PIDfile handling to avoid + SystemD race condition - thanks to Tj for the patch. (LP: #1581864) + + -- Thomas Ward Tue, 04 Jun 2019 11:43:30 -0400 + +nginx (1.16.0-0ubuntu1) eoan; urgency=medium + + * New upstream release (1.16.0) - full changelog available from + http://nginx.org/en/CHANGES + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - d/nginx-{core,light,full,extras}.postinst: Add checks for whether + port 80 is in use or not to determine whether or not to attempt + starting of the NGINX service during install/upgrade + - d/control: Add dependencies to nginx-{core,light,full,extras} on + `iproute2` as the postinst scripts now use `ss` to determine if + Port 80 is open or not. + - d/rules: Enable --with-compat build option for all nginx package + flavors + - d/{control,rules,copyright,modules/http-geoip2*}: Add GeoIP2 third party + module to nginx-full and nginx-extras + + -- Thomas Ward Mon, 29 Apr 2019 12:31:39 -0400 + +nginx (1.15.12-0ubuntu1) eoan; urgency=medium + + * New upstream release (1.15.12) - full changelog available from + http://nginx.org/en/CHANGES + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - d/nginx-{core,light,full,extras}.postinst: Add checks for whether + port 80 is in use or not to determine whether or not to attempt + starting of the NGINX service during install/upgrade + - d/control: Add dependencies to nginx-{core,light,full,extras} on + `iproute2` as the postinst scripts now use `ss` to determine if + Port 80 is open or not. + - d/rules: Enable --with-compat build option for all nginx package + flavors + * Add GeoIP2 third party module to nginx-full and nginx-extras + (LP: #1825895). The following is the files list for this: + - d/{control,rules}: Add libnginx-mod-http-geoip2 and corresponding build + rules. + - d/modules/http-geoip2{,/*}: Add geoip2 module from third party git. + - d/copyright: Add relevant copyright lines for GeoIP2 module. + + -- Thomas Ward Mon, 22 Apr 2019 17:59:46 -0400 + +nginx (1.15.8-0ubuntu1) disco; urgency=medium + + * New upstream release (1.15.8) - full changelog available from + http://nginx.org/en/CHANGES + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - d/nginx-{core,light,full,extras}.postinst: Add checks for whether + port 80 is in use or not to determine whether or not to attempt + starting of the NGINX service during install/upgrade + - d/control: Add dependencies to nginx-{core,light,full,extras} on + `iproute2` as the postinst scripts now use `ss` to determine if + Port 80 is open or not. + - d/rules: Enable --with-compat build option for all nginx package + flavors + + -- Thomas Ward Fri, 01 Feb 2019 20:21:45 -0500 + +nginx (1.15.7-0ubuntu1) disco; urgency=medium + + * New upstream release (1.15.7) - full changelog available from + http://nginx.org/en/CHANGES + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - d/nginx-{core,light,full,extras}.postinst: Add checks for whether + port 80 is in use or not to determine whether or not to attempt + starting of the NGINX service during install/upgrade + - d/control: Add dependencies to nginx-{core,light,full,extras} on + `iproute2` as the postinst scripts now use `ss` to determine if + Port 80 is open or not. + - d/rules: Enable --with-compat build option for all nginx package + flavors (LP: #1797897) + + -- Thomas Ward Tue, 27 Nov 2018 10:28:55 -0500 + +nginx (1.15.6-0ubuntu2) disco; urgency=medium + + * Apply a Debian packaging change to Ubuntu package for config parity: + * d/conf/snippets/fastcgi-php.conf: Adjust fastcgi_split_path_info + snippet to handle the /example.php/ case. (Debian bug 911398) + + -- Thomas Ward Fri, 23 Nov 2018 10:56:21 -0500 + +nginx (1.15.6-0ubuntu1) disco; urgency=medium + + * New upstream release (1.15.6) - full changelog available from + http://nginx.org/en/CHANGES + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - d/nginx-{core,light,full,extras}.postinst: Add checks for whether + port 80 is in use or not to determine whether or not to attempt + starting of the NGINX service during install/upgrade + - d/control: Add dependencies to nginx-{core,light,full,extras} on + `iproute2` as the postinst scripts now use `ss` to determine if + Port 80 is open or not. + - d/rules: Enable --with-compat build option for all nginx package + flavors (LP: #1797897) + + -- Thomas Ward Tue, 13 Nov 2018 10:10:45 -0500 + +nginx (1.15.5-0ubuntu4) disco; urgency=medium + + * No-change rebuild against libhiredis0.14 + + -- Steve Langasek Mon, 12 Nov 2018 08:47:44 +0000 + +nginx (1.15.5-0ubuntu3) disco; urgency=medium + + * No-change rebuild for the perl 5.28 transition. + + -- Adam Conrad Fri, 02 Nov 2018 19:02:18 -0600 + +nginx (1.15.5-0ubuntu2) cosmic; urgency=medium + + * d/conf/nginx.conf: Enable TLSv1.3 by default by adding TLSv1.3 to + the ssl_protocols line. (SRU, LP: #1800214) + + -- Thomas Ward Fri, 26 Oct 2018 15:25:59 -0400 + +nginx (1.15.5-0ubuntu1) cosmic; urgency=medium + + * This is a bugfixes-only upstream micro release, and thus is a bugfixes- + only version change. (LP: #1795690) + * New upstream release (1.15.5) - full changelog available from + http://nginx.org/en/CHANGES + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - d/nginx-{core,light,full,extras}.postinst: Add checks for whether + port 80 is in use or not to determine whether or not to attempt + starting of the NGINX service during install/upgrade + - d/control: Add dependencies to nginx-{core,light,full,extras} on + `iproute2` as the postinst scripts now use `ss` to determine if + Port 80 is open or not. + + -- Thomas Ward Tue, 02 Oct 2018 11:31:05 -0400 + +nginx (1.15.4-0ubuntu1) cosmic; urgency=medium + + * New upstream release (1.15.4) - full changelog available from + http://nginx.org/en/CHANGES (LP: #1794321) + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - d/nginx-{core,light,full,extras}.postinst: Add checks for whether + port 80 is in use or not to determine whether or not to attempt + starting of the NGINX service during install/upgrade + - d/control: Add dependencies to nginx-{core,light,full,extras} on + `iproute2` as the postinst scripts now use `ss` to determine if + Port 80 is open or not. + + -- Thomas Ward Tue, 25 Sep 2018 11:59:46 -0400 + +nginx (1.15.3-0ubuntu1) cosmic; urgency=medium + + * New upstream release (1.15.3) - full changelog available from + http://nginx.org/en/CHANGES (LP: #1790149) + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - d/nginx-{core,light,full,extras}.postinst: Add checks for whether + port 80 is in use or not to determine whether or not to attempt + starting of the NGINX service during install/upgrade + - d/control: Add dependencies to nginx-{core,light,full,extras} on + `iproute2` as the postinst scripts now use `ss` to determine if + Port 80 is open or not. + + -- Thomas Ward Fri, 31 Aug 2018 09:52:34 -0400 + +nginx (1.15.2-0ubuntu2) cosmic; urgency=medium + + * d/control: Add `iproute2` dependencies for the binary + nginx-{core,light,full,extras} packages, they got missed in the + application of the diff in 1.15.2-0ubuntu1. (LP: #1782226) + + -- Thomas Ward Tue, 21 Aug 2018 12:07:59 -0400 + +nginx (1.15.2-0ubuntu1) cosmic; urgency=medium + + * Switch to track NGINX Mainline for 18.10 (and 19.04) releases after + discussion with Server team members. Mainline version is 1.15.2 + * Upstream changelogs for 1.15.2 are available at + http://nginx.org/en/CHANGES + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + * Additional Ubuntu only changes (LP: #1782226): + - d/nginx{core,light,full,extras}.postinst: Add checks for whether + port 80 is in use or not to determine whether or not to attempt + starting of the NGINX service during install/upgrade. + - d/control: Add dependencies to nginx-{core,light,full,extras} on + `iproute2` as the postinst scripts now use `ss` to determine if + Port 80 is open or not. + + -- Thomas Ward Sun, 19 Aug 2018 12:16:48 -0400 + nginx (1.14.2-3) unstable; urgency=high * Backport upstream fixes for 3 CVEs (Closes: #935037) @@ -169,18 +878,85 @@ -- Christos Trochalakis Fri, 31 Aug 2018 15:28:04 +0300 +nginx (1.14.0-0ubuntu2) cosmic; urgency=medium + + * debian/nginx-core.postinst: Make nginx-*.postinst use invoke-rc.d. + (LP: #1578344) + + -- Thomas Ward Tue, 15 May 2018 11:14:02 -0400 + +nginx (1.14.0-0ubuntu1) bionic; urgency=medium + + * New upstream stable release (1.14.0) + * Upstream changelogs can be found at http://nginx.org/en/CHANGES-1.14 + * There are no functional changes or new features in this release, + and the only change is a version number change. + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + + -- Thomas Ward Tue, 17 Apr 2018 12:17:58 -0400 + nginx (1.13.12-1) unstable; urgency=medium * New upstream version -- Christos Trochalakis Wed, 11 Apr 2018 08:19:23 +0300 +nginx (1.13.12-0ubuntu1) bionic; urgency=medium + + * New upstream releases (1.13.11, 1.13.12) + * Upstream changelogs can be found at https://nginx.org/en/CHANGES + * Remaining Ubuntu-specific changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + + -- Thomas Ward Mon, 16 Apr 2018 11:43:01 -0400 + nginx (1.13.11-1) unstable; urgency=medium * New upstream version -- Christos Trochalakis Tue, 10 Apr 2018 14:55:11 +0300 +nginx (1.13.10-1ubuntu1) bionic; urgency=medium + + * Merge with Debian unstable. Remaining changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + * Drop: + - debian/patches/0002-Make-sure-signature-stays-the-same-in- + all-nginx-buil.patch: Refreshed patch - Merge-o-Matic introduced some + fuzz which caused issues. + [ Does not seem necessary ] + - d/control: drop mention of SSL Preread from nginx-full, nginx-extras + [ Previously undocumented ] + - d/gbp.conf: update for 1.12 release + [ Previously undocumented ] + - d/p/0003-define_gnu_source-on-other-glibc-based-platforms.patch: + Refresh patch. + [ Previously undocumented ] + + -- Nishanth Aravamudan Thu, 05 Apr 2018 15:43:49 -0700 + nginx (1.13.10-1) unstable; urgency=medium * New upstream version @@ -226,6 +1002,32 @@ -- Christos Trochalakis Thu, 14 Dec 2017 11:04:36 +0200 +nginx (1.13.6-2ubuntu2) bionic; urgency=high + + * No change rebuild against openssl1.1. + + -- Dimitri John Ledkov Mon, 05 Feb 2018 16:51:17 +0000 + +nginx (1.13.6-2ubuntu1) bionic; urgency=low + + * Merge from Debian unstable. Remaining changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - debian/rules: Alter build flags for cflags and ldflags to fix known + fPIE / fPIC compilation issues (see nginx PPA bug for more details + and information, LP: #1657596) + - debian/patches/0002-Make-sure-signature-stays-the-same-in- + all-nginx-buil.patch: Refreshed patch - Merge-o-Matic introduced some + fuzz which caused issues. + + -- Thomas Ward Tue, 12 Dec 2017 12:15:30 -0500 + nginx (1.13.6-2) unstable; urgency=medium * rtmp: Ship docs & examples (Closes: #878368) @@ -313,6 +1115,37 @@ -- Christos Trochalakis Wed, 10 May 2017 11:40:38 +0300 +nginx (1.12.1-0ubuntu2) artful; urgency=medium + + * No-change rebuild for perl 5.26.0. + + -- Matthias Klose Wed, 26 Jul 2017 20:11:43 +0000 + +nginx (1.12.1-0ubuntu1) artful; urgency=medium + + * New upstream release (1.12.1) - full changelog available at upstream + website - http://nginx.org/en/CHANGES-1.12 + * This release is a security patch micro-release from Upstream. + * This package contains security content to fix the following CVEs: + * CVE-2017-7529: A security issue was identified in nginx range filter. + A specially crafted request might result in an integer overflow and + incorrect processing of ranges, potentially resulting in sensitive + information leak. (Closes LP: #1704151) + * Additional changes: + * d/patches/ubuntu-branding.patch: Refreshed Ubuntu Branding patch. + + -- Thomas Ward Sat, 15 Jul 2017 12:40:15 -0400 + +nginx (1.12.0-1ubuntu1) artful; urgency=medium + + * Merge from Debian Experimental (1.12.0-1, via snapshots.debian.org) + * All Ubuntu-specific changes from Ubuntu 1.12.0-0ubuntu1 were retained. + * Remaining changes: + * d/tests/control: Specify nginx-core flavor tests. + * This merge closes the merge request on Launchpad. (LP: #1704020) + + -- Thomas Ward Wed, 12 Jul 2017 19:53:24 -0400 + nginx (1.12.0-1) experimental; urgency=medium [ Michael Lustfield ] @@ -333,6 +1166,90 @@ -- Christos Trochalakis Fri, 05 May 2017 11:16:30 +0300 +nginx (1.12.0-0ubuntu1) artful; urgency=medium + + * New upstream release: 1.12.0 Stable branch. + * All remaining Ubuntu-specific and Debian-specific changes remain + in place with this upload, the upstream version and code are the + only bits that have been updated, except where indicated below. + * Remaining changes: + - d/modules/nginx-upload-progress/config: Apply upstream patch to + fix an issue where the module does not properly function due to + the wrong module type being set; this prevented the module from + working when built. (LP: #1673056) + - d/patches: The following patches were dropped from the package + because the changes from the patches are already incorporated + in 1.12.0: + - 0004-SSL-error-messages-style.patch + - 0005-SSL-style.patch + - 0006-SSL-support-for-multiple-curves-ticket-885.patch + - d/patches/perl-use-dpkg-buildflags.patch: Refreshed patch to + remove fuzz from the patch. + - d/modules/nginx-echo: Apply upstream diff/patch to fix an FTBFS + - d/modules/nginx-lua: Apply upstream diff/patch to fix an FTBFS + - d/modules/nginx-upstream-fair: Apply diff/patch from the Debian + package maintainers' git repository to not use default_port to + fix an FTBFS. (This will eventually be in Debian, and will get + merged in then as well). + + -- Thomas Ward Wed, 26 Apr 2017 12:02:33 -0400 + +nginx (1.12.0-1) UNRELEASED; urgency=medium + + [ Michael Lustfield ] + * debian/rules: + - Configure build flags to work with other arches and downstreams. + Thanks to Thomas Ward. + + [ Christos Trochalakis ] + * New upstream release. + * Patch nginx-upstream-fair to build against nginx 1.11.6. + * Patch nginx-lua to build against nginx 1.11.11. + * Patch nginx-echo to build against nginx 1.11.11. + * Drop curve list patch, it's included upstream. + * Drop perl build flags patch, it is now handled upstream. + * Enable SSL Preread builtin module on nginx-full & nginx-extras. + (Closes: #854214) + * Switch to debhelper 10, no changes needed. + + -- Christos Trochalakis Fri, 28 Apr 2017 11:14:41 +0300 + +nginx (1.10.3-1ubuntu3) zesty; urgency=medium + + * debian/tests/control: Remove the 'ec-x25519' test stanzas from the + declarations of tests to run. This test requires OpenSSL >= 1.1.0 + to support the X25519 ECDH curve, and we do not have OpenSSL 1.1.0. + This delta can be ***dropped*** when we do have OpenSSL >= 1.1.0. + - This fixes the autopkgtests, of which the Debian merge introduced + a regression due to the ec-x25519 test. + + -- Thomas Ward Mon, 27 Feb 2017 19:51:57 -0500 + +nginx (1.10.3-1ubuntu2) zesty; urgency=low + + * debian/*.save: Junk .save left in the packaging, remove these. + + -- Thomas Ward Thu, 16 Feb 2017 15:39:51 -0500 + +nginx (1.10.3-1ubuntu1) zesty; urgency=medium + + * Merge from Debian unstable (note: 1.10.3 already was merged, but 1.10.3 + packaging changes in Debian were not). Remaining changes are as + follows: (LP: #1664652) + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - debian/rules: Alter build flags for cflags and ldflags to fix known + fPIE / fPIC compilation issues (see nginx PPA bug for more details + and information, LP: #1657596) + + -- Thomas Ward Thu, 16 Feb 2017 15:29:40 -0500 + nginx (1.10.3-1) unstable; urgency=medium * New upstream release. (Closes: #855113) @@ -341,6 +1258,24 @@ -- Christos Trochalakis Wed, 15 Feb 2017 09:58:13 +0200 +nginx (1.10.3-0ubuntu2) zesty; urgency=low + + * Merge from Debian unstable (nginx version there is 1.10.2-4). Remaining + changes: (LP: #1664652) + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + - debian/rules: Alter build flags for cflags and ldflags to fix known + fPIE / fPIC compilation issues (see nginx PPA bug for more details + and information, LP: #1657596) + + -- Thomas Ward Tue, 14 Feb 2017 17:47:00 -0500 + nginx (1.10.2-4) unstable; urgency=medium * Switch module reloading logic to dpkg triggers. @@ -413,6 +1348,18 @@ -- Christos Trochalakis Sat, 29 Oct 2016 08:45:09 +0300 +nginx (1.10.2-0ubuntu1) zesty; urgency=medium + + * New upstream release (1.10.2) - full changelog available at upstream + website - http://nginx.org/en/CHANGES-1.10 - upstream release date + was 18 Oct 2016 + * All other changes from 1.10.1-0ubuntu1 through 1.10.1-0ubuntu5 remain + included + * debian/patches/ubuntu-branding.patch: + - Refreshed Ubuntu Branding patch. + + -- Thomas Ward Thu, 15 Dec 2016 11:23:43 -0500 + nginx (1.10.1-3) unstable; urgency=medium * debian/control: @@ -474,6 +1421,58 @@ -- Christos Trochalakis Tue, 31 May 2016 22:01:25 +0300 +nginx (1.10.1-0ubuntu5) zesty; urgency=medium + + * debian/nginx-common.config: + - Fix the return code so the script does not exit during version + string comparisons. + - Also update the version string to compare with (for zesty only) + + -- Thomas Ward Thu, 27 Oct 2016 10:48:45 -0400 + +nginx (1.10.1-0ubuntu4) zesty; urgency=medium + + * debian/nginx-common.config: + - Fix an issue with the incorrect version numbers being compared + during configuration; this was something I missed when reviewing + the package for uploading previously. (LP: #1637058) + + -- Thomas Ward Thu, 27 Oct 2016 08:45:40 -0400 + +nginx (1.10.1-0ubuntu3) zesty; urgency=medium + + [ Christos Trochalakis ] + * debian/nginx-common.postinst: + + Secure log file handling (owner & permissions) against privilege + escalation attacks. /var/log/nginx is now owned by root:adm. + Thanks Dawid Golunski (http://legalhackers.com) for the report. + Changing /var/log/nginx permissions effectively reopens #701112, + since log files can be world-readable. This is a trade-off until + a better log opening solution is implemented upstream (trac:376). + * debian/control: + Don't allow building against liblua5.1-0-dev on architectures + that libluajit is available. + + -- Thomas Ward Tue, 25 Oct 2016 17:03:54 -0400 + +nginx (1.10.1-0ubuntu2) zesty; urgency=medium + + * No-change rebuild for perl 5.24 transition + + -- Iain Lane Mon, 24 Oct 2016 10:36:19 +0100 + +nginx (1.10.1-0ubuntu1) yakkety; urgency=medium + + * New upstream release (1.10.1) - full changelog available at upstream + website - http://nginx.org/en/CHANGES-1.10. + * Update done to address the following security issues: + - [CVE-2016-4450] NULL pointer dereference while writing client + request body. (LP: #1587577) + * Additional changes: + * debian/patches/ubuntu-branding.patch: Refreshed Ubuntu Branding patch. + + -- Thomas Ward Tue, 31 May 2016 19:09:33 -0400 + nginx (1.10.0-1) unstable; urgency=medium [ Christos Trochalakis ] @@ -481,6 +1480,30 @@ -- Christos Trochalakis Fri, 29 Apr 2016 10:31:46 +0300 +nginx (1.10.0-0ubuntu1) yakkety; urgency=medium + + * New upstream release (1.10.0) - full changelog available at upstream + website - http://nginx.org/en/CHANGES-1.10 (LP: #1575217) + * All Ubuntu specific changes from 1.9.15-0ubuntu1 remain included. + * Additional changes: + * debian/patches/ubuntu-branding.patch: Refreshed Ubuntu Branding patch. + + -- Thomas Ward Tue, 26 Apr 2016 10:24:23 -0400 + +nginx (1.9.15-0ubuntu1) xenial-proposed; urgency=medium + + * New upstream release (1.9.15) - full changelog available at upstream + website - http://nginx.org/en/CHANGES (LP: #1572223) + * All Ubuntu specific changes from 1.1.14-0ubuntu1, except noted below, + remain included in this upload. + * Remaining changes: + * debian/control: Re-add libluajit-5.1-dev build-dependency, as it will + only affect nginx-extras which is in Universe. This reduces the merge + delta between Ubuntu and Debian slightly, as well. (LP: #1571444) + * debian/patches/ubuntu-branding.patch: Refresh Ubuntu Branding patch. + + -- Thomas Ward Mon, 18 Apr 2016 15:39:08 -0400 + nginx (1.9.14-2) unstable; urgency=medium [ Christos Trochalakis ] @@ -524,6 +1547,84 @@ -- Christos Trochalakis Tue, 19 Apr 2016 11:05:35 +0300 +nginx (1.9.14-0ubuntu1) xenial-proposed; urgency=medium + + * New upstream release (1.9.14) - full changelog available at upstream + website - htp://nginx.org/en/CHANGES (LP: #1566392) + * All Ubuntu specific changes from 1.9.13-0ubuntu1, except noted below, + remain included in this upload. + * Remaining changes: + * Enable HTTP/2 module for nginx-full, nginx-extras, and nginx-core + (LP: #1565043) + - debian/rules: Enable HTTP/2 module building in flavor rules + - debian/control: Add HTTP/2 module to package descriptions. + * debian/patches/ubuntu-branding.patch: Refresh Ubuntu Branding patch. + + -- Thomas Ward Fri, 01 Apr 2016 14:23:47 -0400 + +nginx (1.9.13-0ubuntu1) xenial-proposed; urgency=medium + + * New upstream release (1.9.13) - full changelog available at upstream + website - http://nginx.org/en/CHANGES (LP: #1563393) + * All Ubuntu specific changes from 1.9.12-0ubuntu1 remain included in + this upload. + * debian/patches/ubuntu-branding.patch: Refresh Ubuntu Branding patch. + + -- Thomas Ward Tue, 29 Mar 2016 18:47:36 -0400 + +nginx (1.9.12-0ubuntu1) xenial; urgency=medium + + * New upstream release (1.9.12) - full changelog available at upstream + website - http://nginx.org/en/CHANGES (LP: #1549347) + * All Ubuntu specific changes from 1.9.11-0ubuntu1 and -0ubuntu2 remain + included in this upload. + + -- Thomas Ward Wed, 24 Feb 2016 10:26:31 -0500 + +nginx (1.9.11-0ubuntu2) xenial; urgency=medium + + * This is a bug-fix only upload and does not include any new changes to + features. + * debian/conf/sites-available/default: Modify PHP 'default example' settings + to account for php5 being replaced with php7.0 in Xenial. Also adapt the + UNIX socket path for php7.0-fpm to be the one used by default in Xenial. + (LP: #1547642) + + -- Thomas Ward Fri, 19 Feb 2016 14:13:28 -0500 + +nginx (1.9.11-0ubuntu1) xenial; urgency=low + + * New upstream release (1.9.11) - see http://nginx.org/en/CHANGES for + full changelog. + * Ubuntu-specific changes from the 1.9.10 merge remain included here. + * Additional changes: + - debian/modules/nginx-lua: Apply upstream patch to fix FTBFS issue + + -- Thomas Ward Tue, 09 Feb 2016 10:33:14 -0500 + +nginx (1.9.10-1ubuntu1) xenial; urgency=low + + * Merge from Debian unstable. Remaining changes: (LP: #1538677) + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/control: + - drop luajit from Build-Depends as it is in universe. + - Remove HTTP/2 references in package descriptions, per Ubuntu + Security Team mandate to disable HTTP/2 support. + - debian/rules: + - Disable HTTP/2 module support in all flavors, per Ubuntu Security + Team mandate. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + * Additional bugs fixed by this merge: + - nginx-common should not depend on python (LP: #1480513) + + -- Thomas Ward Tue, 27 Jan 2016 12:52:00 -0500 + nginx (1.9.10-1) unstable; urgency=medium [ Christos Trochalakis ] @@ -533,6 +1634,54 @@ -- Christos Trochalakis Tue, 26 Jan 2016 20:12:06 +0200 +nginx (1.9.10-0ubuntu1) xenial; urgency=medium + + * New upstream release. + * debian/patches/ubuntu-branding.patch: Refreshed Ubuntu Branding patch + * Security content of this upload addresses the following vulnerabilities + and CVE-numbered Security issues: (LP: #1538165) + - Invalid pointer dereference might occur during DNS server response + processing, allowing an attacker who is able to forge UDP + packets from the DNS server to cause worker process crash + (CVE-2016-0742). + - Use-after-free condition might occur during CNAME response + processing. This problem allows an attacker who is able to trigger + name resolution to cause worker process crash, or might + have potential other impact (CVE-2016-0746). + - CNAME resolution was insufficiently limited, allowing an attacker who + is able to trigger arbitrary name resolution to cause excessive resource + consumption in worker processes (CVE-2016-0747). + + -- Thomas Ward Tue, 26 Jan 2016 14:53:01 -0500 + +nginx (1.9.9-1ubuntu1) xenial; urgency=low + + * Merge from Debian unstable. Remaining changes: (LP: #1534208) + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/control: + - drop luajit from Build-Depends as it is in universe. + - Update nginx-core description to match nginx-full description of the + standard and optional HTTP modules that are enabled. + - Remove HTTP/2 references in package descriptions, per Ubuntu + Security Team mandate to disable HTTP/2 support. + - debian/rules: + - Update nginx-core configure flags to match nginx-full config flags, + due to refreshing the nginx-core 'enabled modules' to match the + nginx-full modules (minus third-party modules) + - Disable HTTP/2 module support in all flavors, per Ubuntu Security + Team mandate. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + * debian/control: Remove HTTP/2 reference in nginx-extras description, which + was missed previously due to accidental oversight. (LP: #1534368) + + -- Thomas Ward Thu, 14 Jan 2016 18:42:00 -0500 + nginx (1.9.9-1) unstable; urgency=medium [ Michael Lustfield ] @@ -546,6 +1695,46 @@ -- Christos Trochalakis Thu, 14 Jan 2016 10:40:35 +0200 +nginx (1.9.9-0ubuntu1) xenial; urgency=medium + + * New upstream release. + * debian/patches/ubuntu-branding.patch: Refreshed Ubuntu Branding patch + + -- Thomas Ward Sun, 03 Jan 2016 12:49:21 -0500 + +nginx (1.9.6-2ubuntu2) xenial; urgency=medium + + * Rebuild for Perl 5.22.1. + + -- Colin Watson Fri, 18 Dec 2015 12:53:05 +0000 + +nginx (1.9.6-2ubuntu1) xenial; urgency=medium + + * Merge from Debian unstable. Remaining changes: (LP: #1510096) + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/control: drop luajit from Build-Depends as it is in universe. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + * Additional changes: + * debian/rules: + - Update nginx-core configure flags to match nginx-full config flags, + due to refreshing the nginx-core 'enabled modules' to match the + nginx-full modules (minus third-party modules) + - Disable HTTP/2 module support in all flavors, per Ubuntu Security + Team mandate. + * debian/control: + - Update nginx-core description to match nginx-full description of the + standard and optional HTTP modules that are enabled. + - Remove HTTP/2 references in package descriptions, per Ubuntu + Security Team mandate to disable HTTP/2 support. + + -- Thomas Ward Mon, 14 Dec 2015 10:34:42 -0500 + nginx (1.9.6-2) unstable; urgency=medium [ Christos Trochalakis] @@ -571,6 +1760,21 @@ -- Christos Trochalakis Mon, 24 Aug 2015 16:23:20 +0300 +nginx (1.9.3-1ubuntu1) wily; urgency=medium + + * Merge from Debian. Remaining changes: (LP: #1476811) + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/control: drop luajit from Build-Depends as it is in universe. + - debian/apport/source_nginx.py: Add apport hooks for additional bug + information gathering. + - debian/nginx-common.install: Add install rule for apport hooks. + + -- Thomas Ward Wed, 22 Jul 2015 11:39:44 -0400 + nginx (1.9.3-1) unstable; urgency=medium [ Christos Trochalakis] @@ -655,6 +1859,52 @@ -- Christos Trochalakis Fri, 12 Jun 2015 15:42:49 +0300 +nginx (1.6.2-5ubuntu4) wily; urgency=medium + + * debian/apport/source_nginx.py: + - Add apport hooks for additional bug information gathering, as a result + of non-useful reports due to postinstall script failure bugs. This is + necessary in order to be able to actually debug what is going on in the + bug reports, thanks to systemd not putting startup errors to stdout or + stderr anymore, like Upstart and others did. (LP: #1472683) + * debian/nginx-common.install: + - Add install rule for debian/apport/source_nginx.py, which is the new + apport hooks to gather additional 'Package' bugtype debug data. + + -- Thomas Ward Fri, 10 Jul 2015 12:51:48 -0400 + +nginx (1.6.2-5ubuntu3) vivid-proposed; urgency=medium + + * debian/rules: + * Reversed Debian change in 1.6.2-5ubuntu2. + * Added DEB_BUILD_MAINT_OPTIONS=hardening=+all to enable all + dpkg-buildflags to harden the code, except for PIE flags. + * Manually define DEB_BUILD_MAINT_OPTIONS in DEBIAN_NGINX_PERL_LDFLAGS + to not have -fPIE conflicts in Perl flags. + + -- Thomas Ward Wed, 01 Apr 2015 14:57:34 -0400 + +nginx (1.6.2-5ubuntu2) vivid-proposed; urgency=medium + + * debian/rules: + * Added -fPIE -pie to build rules (enables position-independent builds) + using Debian's committed change to enable. (LP: #1315426) + + -- Thomas Ward Wed, 01 Apr 2015 14:26:32 -0400 + +nginx (1.6.2-5ubuntu1) vivid; urgency=medium + + * Merge from Debian. Remaining changes: (LP: #1399967) + - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed) + - debian/rules: Drop from -O3 to -O2 to work around a build failure. + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/control: drop luajit from Build-Depends as it is in universe. + + -- Thomas Ward Sat, 06 Dec 2014 13:06:55 -0500 + nginx (1.6.2-5) unstable; urgency=medium [ Christos Trochalakis ] @@ -670,6 +1920,27 @@ -- Christos Trochalakis Sun, 30 Nov 2014 10:39:55 +0200 +nginx (1.6.2-4ubuntu1) vivid; urgency=medium + + * Merge from Debian. Remaining changes: (LP: #1388621) + - debian/patches/ubuntu-branding.patch: add Ubuntu branding + (refreshed). + - debian/rules: Drop from -O3 to -O2 to work around a build failure. + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + - debian/tests/control: add nginx-core test. + - debian/control: drop luajit from Build-Depends as it is in universe. + * debian/control: + * Remove nginx-naxsi* from nginx-core and related + package stanzas, as the naxsi packages have all been dropped. + * Remove reference to nginx-naxsi from nginx metapackage description + * debian/index.html: Modify included index.html file to have Ubuntu + branding, Ubuntu bug reporting tool references, and a link to the + Launchpad bugs page for the nginx package. + + -- Thomas Ward Wed, 05 Nov 2014 10:05:07 -0500 + nginx (1.6.2-4) unstable; urgency=medium [ Christos Trochalakis ] @@ -721,6 +1992,27 @@ -- Christos Trochalakis Fri, 26 Sep 2014 11:06:47 +0300 +nginx (1.6.2-1ubuntu1.1) utopic; urgency=medium + + * debian/conf/sites-available/default: Remove SSLv3 from the ssl_protocols + line in the default config example, due to POODLE vulnerability. + + -- Thomas Ward Wed, 22 Oct 2014 09:43:35 -0400 + +nginx (1.6.2-1ubuntu1) utopic; urgency=medium + + * Merge from Debian. Remaining changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding + (refreshed). + - debian/rules: Drop from -O3 to -O2 to work around a build failure. + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + * debian/tests/control: add nginx-core test. + * debian/control: drop luajit from Build-Depends as it is in universe. + + -- Marc Deslauriers Mon, 22 Sep 2014 13:32:30 -0400 + nginx (1.6.2-1) unstable; urgency=high [ Christos Trochalakis ] @@ -768,6 +2060,25 @@ -- Christos Trochalakis Thu, 04 Sep 2014 13:00:46 +0300 +nginx (1.6.1-1ubuntu2) utopic; urgency=medium + + * Rebuild for Perl 5.20.0. + + -- Colin Watson Sun, 24 Aug 2014 06:43:36 -0700 + +nginx (1.6.1-1ubuntu1) utopic; urgency=medium + + * Merge from Debian. Remaining changes: + - debian/patches/ubuntu-branding.patch: add Ubuntu branding + (refreshed). + - debian/rules: Drop from -O3 to -O2 to work around a build failure. + - d/{control,rules,nginx-core.*}: add new binary package for main, + nginx-core, which contains only source-tarball-included modules + and no third-party modules. + * Add dep8 smoke test + + -- Robie Basak Fri, 15 Aug 2014 16:46:48 +0000 + nginx (1.6.1-1) unstable; urgency=medium [ Christos Trochalakis ] @@ -833,6 +2144,34 @@ -- Christos Trochalakis Tue, 18 Mar 2014 22:03:47 +0200 +nginx (1.4.6-1ubuntu3) trusty; urgency=medium + + * Add new binary package for main, nginx-core, which contains only + source-tarball-included modules and no third-party modules. + * Changes to debian/ directory: + - control: + + Add entry for nginx-core and nginx-core-dbg. + - rules: + + Add nginx-core flavor to the build rules. + - nginx-core.*: Add new packaging files for nginx-core based on + the packaging files for nginx-full. + * The above changes satisfy the requirements for main (LP: #1262710) + + -- Thomas Ward Mon, 10 Mar 2014 18:23:36 -0400 + +nginx (1.4.6-1ubuntu2) trusty; urgency=medium + + * debian/rules: Drop from -O3 to -O2 to work around a build failure. + + -- Adam Conrad Sun, 09 Mar 2014 11:49:28 -0600 + +nginx (1.4.6-1ubuntu1) trusty; urgency=low + + * Merge from Debian unstable. Remaining changes: + - debian/patches/ubuntu-branding.patch: Add Ubuntu branding. + + -- Adam Conrad Sun, 09 Mar 2014 11:13:26 -0600 + nginx (1.4.6-1) unstable; urgency=medium [ Christos Trochalakis ] @@ -854,6 +2193,14 @@ -- Christos Trochalakis Tue, 04 Mar 2014 18:06:55 +0200 +nginx (1.4.5-1ubuntu1) trusty; urgency=medium + + * Resynchronise with Debian (LP: #1280511). Remaining changes: + - debian/patches/ubuntu-branding.patch: + + Add Ubuntu branding to server_tokens. + + -- Colin Watson Sat, 15 Feb 2014 03:05:42 +0000 + nginx (1.4.5-1) unstable; urgency=medium [ Christos Trochalakis ] @@ -894,6 +2241,14 @@ -- Christos Trochalakis Tue, 31 Dec 2013 11:47:07 +0200 +nginx (1.4.4-2ubuntu1) trusty; urgency=medium + + * Resynchronise with Debian. Remaining changes: + - debian/patches/ubuntu-branding.patch: + + Add Ubuntu branding to server_tokens. + + -- Colin Watson Sat, 28 Dec 2013 10:21:44 +0000 + nginx (1.4.4-2) unstable; urgency=low [ Michael Lustfield ] @@ -931,6 +2286,14 @@ -- Kartik Mistry Fri, 27 Dec 2013 21:16:01 +0530 +nginx (1.4.4-1ubuntu1) trusty; urgency=low + + * Resynchronise with Debian (LP: #1253691). Remaining changes: + - debian/patches/ubuntu-branding.patch: + + Add Ubuntu branding to server_tokens. + + -- Colin Watson Fri, 22 Nov 2013 12:23:25 +0000 + nginx (1.4.4-1) unstable; urgency=low [ Christos Trochalakis ] @@ -955,6 +2318,14 @@ -- Michael Lustfield Thu, 21 Nov 2013 19:25:50 +0530 +nginx (1.4.3-2ubuntu1) trusty; urgency=low + + * Resynchronise with Debian. Remaining changes: + - debian/patches/ubuntu-branding.patch: + + Add Ubuntu branding to server_tokens. + + -- Colin Watson Mon, 21 Oct 2013 13:26:52 +0100 + nginx (1.4.3-2) unstable; urgency=low [ Kartik Mistry ] @@ -1011,6 +2382,14 @@ -- Kartik Mistry Thu, 10 Oct 2013 17:28:56 +0530 +nginx (1.4.1-3ubuntu1) saucy; urgency=low + + * Resynchronise with Debian. Remaining changes: + - debian/patches/ubuntu-branding.patch: + + Add Ubuntu branding to server_tokens. + + -- Colin Watson Thu, 20 Jun 2013 15:08:44 +0100 + nginx (1.4.1-3) unstable; urgency=low [ Kartik Mistry ] @@ -1024,6 +2403,14 @@ -- Kartik Mistry Sun, 09 Jun 2013 13:07:52 +0530 +nginx (1.4.1-2ubuntu1) saucy; urgency=low + + * Resynchronise with Debian. Remaining changes: + - debian/patches/ubuntu-branding.patch: + + Add Ubuntu branding to server_tokens. + + -- Colin Watson Fri, 07 Jun 2013 15:41:48 +0100 + nginx (1.4.1-2) unstable; urgency=medium [ Kartik Mistry] @@ -1045,6 +2432,24 @@ -- Kartik Mistry Thu, 06 Jun 2013 12:55:23 +0530 +nginx (1.4.1-1ubuntu2) saucy; urgency=low + + * Rebuild for libgd3. + + -- Colin Watson Mon, 20 May 2013 00:45:10 +0100 + +nginx (1.4.1-1ubuntu1) saucy; urgency=low + + * Merge with Debian unstable (LP: #1177919). Remaining changes: + - debian/conf/sites-available/default: + + Modify default site configuration file to correct a typo + that prevented out-of-the-box usability (LP: #1162177). + - debian/patches/ubuntu-branding.patch: + + Add ubuntu branding to server_tokens. + * Refresh all patches. + + -- Dmitry Shachnev Sat, 11 May 2013 14:47:53 +0400 + nginx (1.4.1-1) unstable; urgency=low * New upstream release: @@ -1122,6 +2527,36 @@ -- Kartik Mistry Thu, 25 Apr 2013 12:51:45 +0530 +nginx (1.2.6-1ubuntu4) saucy; urgency=low + + * debian/patches/ubuntu-branding.patch: Move Ubuntu branding from + the numerical version string to the long version (LP: #1174158) + + -- Adam Conrad Thu, 09 May 2013 11:50:52 -0600 + +nginx (1.2.6-1ubuntu3) raring; urgency=low + + * debian/patches/ubuntu-branding.patch: Add ubuntu branding + to server_tokens. + + -- Chuck Short Tue, 09 Apr 2013 10:23:26 -0500 + +nginx (1.2.6-1ubuntu2) raring; urgency=low + + * debian/conf/sites-available/default: + * Modify default site configuration file to correct a typo + that prevented out-of-the-box usability (LP: #1162177) + + -- Thomas Ward Fri, 05 Apr 2013 20:22:38 +0100 + +nginx (1.2.6-1ubuntu1) raring; urgency=low + + * debian/conf/sites-available/default: + * Modify default site default configuration file to bind to IPv6 + only for IPv6 default listen statement (LP: #1132678) + + -- Thomas Ward Tue, 12 Mar 2013 00:23:02 +0000 + nginx (1.2.6-1) unstable; urgency=low [ Kartik Mistry ] diff -Nru nginx-1.18.0/debian/control nginx-1.18.0/debian/control --- nginx-1.18.0/debian/control 2020-08-19 13:11:02.000000000 +0000 +++ nginx-1.18.0/debian/control 2021-03-10 00:03:51.000000000 +0000 @@ -1,7 +1,8 @@ Source: nginx Section: httpd Priority: optional -Maintainer: Debian Nginx Maintainers +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Debian Nginx Maintainers Uploaders: Christos Trochalakis , Ondřej Nový , Build-Depends: debhelper-compat (= 13), @@ -10,8 +11,6 @@ libgd-dev, libgeoip-dev, libhiredis-dev, - liblua5.1-0-dev [!i386 !amd64 !kfreebsd-i386 !armel !armhf !powerpc !powerpcspe !mips !mipsel], - libluajit-5.1-dev [i386 amd64 kfreebsd-i386 armel armhf powerpc powerpcspe mips mipsel], libmaxminddb-dev, libmhash-dev, libpam0g-dev, @@ -29,10 +28,12 @@ Rules-Requires-Root: no Package: nginx -Architecture: all +# See LP: #1893267 +Architecture: any Depends: nginx-core (<< ${source:Version}.1~) | nginx-full (<< ${source:Version}.1~) | nginx-light (<< ${source:Version}.1~) | nginx-extras (<< ${source:Version}.1~), nginx-core (>= ${source:Version}) | nginx-full (>= ${source:Version}) | nginx-light (>= ${source:Version}) | nginx-extras (>= ${source:Version}), ${misc:Depends} +Breaks: libnginx-mod-http-lua (<< 1.18.0-6ubuntu5) Description: small, powerful, scalable web/proxy server Nginx ("engine X") is a high-performance web and reverse proxy server created by Igor Sysoev. It can be used both as a standalone web server @@ -68,12 +69,12 @@ Package: nginx-core Architecture: any -Depends: libnginx-mod-http-geoip (= ${binary:Version}), - libnginx-mod-http-image-filter (= ${binary:Version}), +Depends: libnginx-mod-http-image-filter (= ${binary:Version}), libnginx-mod-http-xslt-filter (= ${binary:Version}), + libnginx-mod-http-geoip2 (= ${binary:Version}), libnginx-mod-mail (= ${binary:Version}), libnginx-mod-stream (= ${binary:Version}), - libnginx-mod-stream-geoip (= ${binary:Version}), + libnginx-mod-stream-geoip2 (= ${binary:Version}), nginx-common (= ${source:Version}), iproute2, ${misc:Depends}, @@ -97,17 +98,20 @@ GIF, FastCGI, Geo, Limit Connections, Limit Requests, Map, Memcached, Proxy, Referer, Rewrite, SCGI, Split Clients, UWSGI. . - OPTIONAL HTTP MODULES: Addition, Auth Request, Charset, WebDAV, GeoIP, Gunzip, + OPTIONAL HTTP MODULES: Addition, Auth Request, Charset, WebDAV, Gunzip, Gzip, Gzip Precompression, Headers, HTTP/2, Image Filter, Index, Log, Real IP, - Slice, SSI, SSL, SSL Preread, Stub Status, Substitution, Thread Pool, + Slice, SSI, SSL, SSL Preread, Stub Status, Substitution, Thread Pool, Upstream, User ID, XSLT. . + THIRD PARTY HTTP MODULES: GeoIP2 + . OPTIONAL MAIL MODULES: Mail Core, Auth HTTP, Proxy, SSL, IMAP, POP3, SMTP. . - OPTIONAL STREAM MODULES: Stream Core, GeoIP + OPTIONAL STREAM MODULES: Stream Core Package: nginx-full -Architecture: all +# See LP: #1893267 +Architecture: any Depends: libnginx-mod-http-auth-pam, libnginx-mod-http-dav-ext, libnginx-mod-http-echo, @@ -135,14 +139,14 @@ GIF, FastCGI, Geo, Limit Connections, Limit Requests, Map, Memcached, Proxy, Referer, Rewrite, SCGI, Split Clients, UWSGI. . - OPTIONAL HTTP MODULES: Addition, Auth Request, Charset, WebDAV, GeoIP, Gunzip, + OPTIONAL HTTP MODULES: Addition, Auth Request, Charset, WebDAV, GeoIP2, Gunzip, Gzip, Gzip Precompression, Headers, HTTP/2, Image Filter, Index, Log, Real IP, Slice, SSI, SSL, Stream, SSL Preread, Stub Status, Substitution, Thread Pool, Upstream, User ID, XSLT. . OPTIONAL MAIL MODULES: Mail Core, Auth HTTP, Proxy, SSL, IMAP, POP3, SMTP. . - OPTIONAL STREAM MODULES: Stream Core, GeoIP, GeoIP2 + OPTIONAL STREAM MODULES: Stream Core . THIRD PARTY MODULES: Auth PAM, DAV Ext, Echo, GeoIP2, HTTP Substitutions Upstream Fair Queue. @@ -150,6 +154,7 @@ Package: nginx-light Architecture: any Depends: libnginx-mod-http-echo (= ${binary:Version}), + libnginx-mod-http-geoip2 (= ${binary:Version}), nginx-common (= ${source:Version}), iproute2, ${misc:Depends}, @@ -173,7 +178,7 @@ Headers, HTTP/2, Index, Log, Real IP, Slice, SSI, SSL, Stub Status, Thread Pool, WebDAV, Upstream. . - THIRD PARTY MODULES: Echo. + THIRD PARTY MODULES: Echo, GeoIP2 Package: nginx-extras Architecture: any @@ -186,7 +191,6 @@ libnginx-mod-http-geoip2 (= ${binary:Version}), libnginx-mod-http-headers-more-filter (= ${binary:Version}), libnginx-mod-http-image-filter (= ${binary:Version}), - libnginx-mod-http-lua (= ${binary:Version}), libnginx-mod-http-perl (= ${binary:Version}), libnginx-mod-http-subs-filter (= ${binary:Version}), libnginx-mod-http-uploadprogress (= ${binary:Version}), @@ -201,7 +205,7 @@ iproute2, ${misc:Depends}, ${shlibs:Depends} -Breaks: nginx (<< 1.4.5-1) +Breaks: nginx (<< 1.4.5-1), libnginx-mod-http-lua (<< 1.18.0-6ubuntu5) Provides: httpd, httpd-cgi, nginx Conflicts: nginx-core, nginx-light Suggests: nginx-doc (= ${source:Version}) @@ -244,7 +248,7 @@ Package: libnginx-mod-http-geoip2 Architecture: any -Depends: ${misc:Depends}, ${shlibs:Depends}, +Depends: ${misc:Depends}, ${shlibs:Depends}, libmaxminddb0 Recommends: nginx, Description: GeoIP2 HTTP module for Nginx The ngx_http_geoip2 module creates variables with values depending on the @@ -343,20 +347,6 @@ The module uses PAM as a backend for simple http authentication. It also allows setting the pam service name to allow more fine grained control. -Package: libnginx-mod-http-lua -Architecture: any -Depends: libnginx-mod-http-ndk (= ${binary:Version}), - ${misc:Depends}, - ${shlibs:Depends}, -Recommends: nginx, -Description: Lua module for Nginx - Embed Lua runtime into nginx. - . - This module embeds Lua, via the standard Lua 5.1 interpreter or LuaJIT - 2.0/2.1, into Nginx and by leveraging Nginx's subrequests, allows the - integration of the powerful Lua threads (Lua coroutines) into the Nginx event - model. - Package: libnginx-mod-http-ndk Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends}, diff -Nru nginx-1.18.0/debian/copyright nginx-1.18.0/debian/copyright --- nginx-1.18.0/debian/copyright 2020-08-19 13:11:02.000000000 +0000 +++ nginx-1.18.0/debian/copyright 2021-03-08 15:13:44.000000000 +0000 @@ -76,11 +76,6 @@ Copyright: 2009-2014, Yichun "agentzh" Zhang License: BSD-2-clause -Files: debian/modules/http-lua/* -Copyright: 2009-2017, by Xiaozhe Wang (chaoslawful) . - 2009-2018, by Yichun "agentzh" Zhang (章亦春) , OpenResty Inc. -License: BSD-2-clause - Files: debian/modules/http-lua/t/lib/CRC32.lua Copyright: 2007-2008, Neil Richardson (nrich@iinet.net.au) License: Expat diff -Nru nginx-1.18.0/debian/libnginx-mod.conf/mod-http-lua.conf nginx-1.18.0/debian/libnginx-mod.conf/mod-http-lua.conf --- nginx-1.18.0/debian/libnginx-mod.conf/mod-http-lua.conf 2020-05-28 20:03:01.000000000 +0000 +++ nginx-1.18.0/debian/libnginx-mod.conf/mod-http-lua.conf 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -load_module modules/ngx_http_lua_module.so; diff -Nru nginx-1.18.0/debian/libnginx-mod-http-lua.nginx nginx-1.18.0/debian/libnginx-mod-http-lua.nginx --- nginx-1.18.0/debian/libnginx-mod-http-lua.nginx 2020-05-28 20:03:01.000000000 +0000 +++ nginx-1.18.0/debian/libnginx-mod-http-lua.nginx 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -#!/usr/bin/perl -w - -use File::Basename; - -# Guess module name -$module = basename($0, '.nginx'); -$module =~ s/^libnginx-mod-//; - -$modulepath = $module; -$modulepath =~ s/-/_/g; - -print "mod debian/build-extras/objs/ngx_${modulepath}_module.so\n"; -print "mod debian/libnginx-mod.conf/mod-${module}.conf\n"; diff -Nru nginx-1.18.0/debian/modules/control nginx-1.18.0/debian/modules/control --- nginx-1.18.0/debian/modules/control 2020-08-19 13:11:02.000000000 +0000 +++ nginx-1.18.0/debian/modules/control 2021-03-10 15:49:10.000000000 +0000 @@ -20,14 +20,6 @@ Homepage: https://github.com/leev/ngx_http_geoip2_module Version: 3.3 -Module: http-lua -Homepage: https://github.com/openresty/lua-nginx-module -Version: 0.10.13 -Patch: - openssl-1.1.0.patch - discover-luajit-2.1.patch -Files-Excluded: .gitignore .gitattributes .travis.yml .github - Module: http-upstream-fair Homepage: https://github.com/gnosek/nginx-upstream-fair Version: a18b409 diff -Nru nginx-1.18.0/debian/modules/http-lua/config nginx-1.18.0/debian/modules/http-lua/config --- nginx-1.18.0/debian/modules/http-lua/config 2020-07-14 07:50:41.000000000 +0000 +++ nginx-1.18.0/debian/modules/http-lua/config 1970-01-01 00:00:00.000000000 +0000 @@ -1,532 +0,0 @@ -ngx_feature="Lua library" -ngx_feature_libs="-llua -lm" -ngx_feature_name= -ngx_feature_run=no -ngx_feature_incs="#include " -ngx_feature_path= -ngx_feature_test="#if LUA_VERSION_NUM != 501 -# error unsupported Lua language version -#endif -(void) luaL_newstate();" -ngx_lua_opt_I= -ngx_lua_opt_L= - -if [ -n "$LUAJIT_INC" -o -n "$LUAJIT_LIB" ]; then - # explicitly set LuaJIT paths - - if [ "$NGX_PLATFORM" = win32 ]; then - ngx_feature="LuaJIT library in $LUAJIT_LIB and $LUAJIT_INC (win32)" - ngx_feature_path="$LUAJIT_INC" - ngx_lua_opt_I="-I$LUAJIT_INC" - ngx_lua_opt_L="-L$LUAJIT_LIB" - - # ensure that our -I$LUAJIT_INC and -L$LUAJIT_LIB is at the first. - SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" - CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS" - SAVED_NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT" - NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT" - - # LuaJIT's win32 build uses the library file name lua51.dll. - ngx_feature_libs="$ngx_lua_opt_L -llua51" - - . auto/feature - - # clean up - CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" - NGX_TEST_LD_OPT="$SAVED_NGX_TEST_LD_OPT" - else - - # attempt to link with -ldl, static linking on Linux requires it. - ngx_feature="LuaJIT library in $LUAJIT_LIB and $LUAJIT_INC (specified by the LUAJIT_LIB and LUAJIT_INC env, with -ldl)" - ngx_feature_path="$LUAJIT_INC" - ngx_lua_opt_I="-I$LUAJIT_INC" - ngx_lua_opt_L="-L$LUAJIT_LIB" - - # ensure that our -I$LUAJIT_INC and -L$LUAJIT_LIB is at the first. - SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" - CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS" - SAVED_NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT" - NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R$LUAJIT_LIB $ngx_lua_opt_L -lluajit-5.1 -lm -ldl" - else - ngx_feature_libs="$ngx_lua_opt_L -lluajit-5.1 -lm -ldl" - fi - - . auto/feature - - # clean up - CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" - NGX_TEST_LD_OPT="$SAVED_NGX_TEST_LD_OPT" - - if [ $ngx_found = no ]; then - # retry without -ldl - ngx_feature="LuaJIT library in $LUAJIT_LIB and $LUAJIT_INC (specified by the LUAJIT_LIB and LUAJIT_INC env)" - ngx_feature_path="$LUAJIT_INC" - ngx_lua_opt_I="-I$LUAJIT_INC" - ngx_lua_opt_L="-L$LUAJIT_LIB" - - # ensure that our -I$LUAJIT_INC and -L$LUAJIT_LIB is at the first. - SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" - CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS" - SAVED_NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT" - NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R$LUAJIT_LIB $ngx_lua_opt_L -lluajit-5.1 -lm" - else - ngx_feature_libs="$ngx_lua_opt_L -lluajit-5.1 -lm" - fi - - . auto/feature - - # clean up - CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" - NGX_TEST_LD_OPT="$SAVED_NGX_TEST_LD_OPT" - fi - fi - - if [ $ngx_found = no ]; then - cat << END - $0: error: ngx_http_lua_module requires the Lua or LuaJIT library and LUAJIT_LIB is defined as $LUAJIT_LIB and LUAJIT_INC (path for lua.h) $LUAJIT_INC, but we cannot find LuaJIT there. -END - exit 1 - fi - - case "$NGX_PLATFORM" in - Darwin:*) - case "$NGX_MACHINE" in - amd64 | x86_64 | i386) - echo "adding extra linking options needed by LuaJIT" - ngx_feature_libs="$ngx_feature_libs -pagezero_size 10000 -image_base 100000000" - ;; - - *) - ;; - esac - ;; - - *) - ;; - esac -else - if [ -n "$LUA_INC" -o -n "$LUA_LIB" ]; then - # explicitly set Lua paths - ngx_feature="Lua library in $LUA_LIB and $LUA_INC (specified by the LUA_LIB and LUA_INC env)" - ngx_feature_path="$LUA_INC" - ngx_lua_opt_I="-I$LUA_INC" - ngx_lua_opt_L="-L$LUA_LIB" - - # ensure that our -I$LUA_INC and -L$LUA_LIB is at the first. - SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" - CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS" - SAVED_NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT" - NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R$LUA_LIB $ngx_lua_opt_L -llua -lm -ldl" - else - ngx_feature_libs="$ngx_lua_opt_L -llua -lm -ldl" - fi - - . auto/feature - - # clean up - CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" - NGX_TEST_LD_OPT="$SAVED_NGX_TEST_LD_OPT" - - if [ $ngx_found = no ]; then - # retry without -ldl - - ngx_feature_path="$LUA_INC" - ngx_lua_opt_I="-I$LUA_INC" - ngx_lua_opt_L="-L$LUA_LIB" - - # ensure that our -I$LUA_INC and -L$LUA_LIB is at the first. - SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" - CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS" - SAVED_NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT" - NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R$LUA_LIB $ngx_lua_opt_L -llua -lm" - else - ngx_feature_libs="$ngx_lua_opt_L -llua -lm" - fi - - . auto/feature - - # clean up - CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" - NGX_TEST_LD_OPT="$SAVED_NGX_TEST_LD_OPT" - fi - - if [ $ngx_found = no ]; then - cat << END - $0: error: ngx_http_lua_module requires the Lua or LuaJIT library and LUA_LIB is defined as $LUA_LIB and LUA_INC (path for lua.h) is $LUA_INC, but we cannot find standard Lua there. -END - exit 1 - fi - else - # auto-discovery - ngx_feature="Lua library" - ngx_feature_libs="-llua -lm" - . auto/feature - - if [ $ngx_found = no ]; then - # OpenBSD-5.2 - ngx_feature="Lua library in /usr/local/" - ngx_feature_path="/usr/local/include/lua-5.1" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -llua -lm" - else - ngx_feature_libs="-L/usr/local/lib -llua5.1 -lm" - fi - . auto/feature - fi - - if [ $ngx_found = no ]; then - # OpenBSD < 5.2 - ngx_feature="Lua library in /usr/local/" - ngx_feature_path="/usr/local/include" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -llua -lm" - else - ngx_feature_libs="-L/usr/local/lib -llua -lm" - fi - . auto/feature - fi - - if [ $ngx_found = no ]; then - # NetBSD - ngx_feature="Lua library in /usr/pkg/" - ngx_feature_path="/usr/pkg/include/" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lm -llua" - else - ngx_feature_libs="-L/usr/pkg/lib -lm -llua" - fi - . auto/feature - fi - - if [ $ngx_found = no ]; then - # MacPorts - ngx_feature="Lua library in /opt/local/" - ngx_feature_path="/opt/local/include" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lm -llua" - else - ngx_feature_libs="-L/opt/local/lib -lm -llua" - fi - . auto/feature - fi - - if [ $ngx_found = no ]; then - # FreeBSD - ngx_feature="Lua library in /usr/local/*/lua51/" - ngx_feature_path="/usr/local/include/lua51" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/local/lib/lua51 -L/usr/local/lib/lua51 -llua -lm" - else - ngx_feature_libs="-L/usr/local/lib/lua51 -llua -lm" - fi - . auto/feature - fi - - if [ $ngx_found = no ]; then - # Debian - ngx_feature="Lua library in /usr/" - ngx_feature_path="/usr/include/lua5.1" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/lib -L/usr/lib -lm -llua5.1" - else - ngx_feature_libs="-L/usr/lib -lm -llua5.1" - fi - . auto/feature - fi - - if [ $ngx_found = no ]; then - # FreeBSD with luajit-2.0 from ports collection - ngx_feature="LuaJIT library in /usr/local/" - ngx_feature_path="/usr/local/include/luajit-2.0" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lluajit-5.1 -lm" - else - ngx_feature_libs="-L/usr/local/lib -lluajit-5.1 -lm" - fi - . auto/feature - fi - - if [ $ngx_found = no ]; then - # Gentoo with LuaJIT-2.0, try with -ldl - ngx_feature="LuaJIT library in /usr/" - ngx_feature_path="/usr/include/luajit-2.0" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/lib -L/usr/lib -lm -lluajit-5.1 -ldl" - else - ngx_feature_libs="-L/usr/lib -lm -lluajit-5.1 -ldl" - fi - . auto/feature - fi - - if [ $ngx_found = no ]; then - # Gentoo with LuaJIT 2.0 - ngx_feature="LuaJIT library in /usr/" - ngx_feature_path="/usr/include/luajit-2.0" - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/lib -L/usr/lib -lm -lluajit-5.1" - else - ngx_feature_libs="-L/usr/lib -lm -lluajit-5.1" - fi - . auto/feature - fi - fi -fi - -ngx_module_incs= -ngx_module_libs= - -if [ $ngx_found = yes ]; then - # this is a hack to persuade nginx's build system to favor - # the paths set by our user environments: - CFLAGS="$ngx_lua_opt_I $CFLAGS" - NGX_LD_OPT="$ngx_lua_opt_L $NGX_LD_OPT" - - ngx_module_incs="$ngx_module_incs $ngx_feature_path" - ngx_module_libs="$ngx_module_libs $ngx_feature_libs" -else - cat << END - $0: error: ngx_http_lua_module requires the Lua library. -END - exit 1 -fi - -ngx_addon_name=ngx_http_lua_module -HTTP_LUA_SRCS=" \ - $ngx_addon_dir/src/ngx_http_lua_script.c \ - $ngx_addon_dir/src/ngx_http_lua_log.c \ - $ngx_addon_dir/src/ngx_http_lua_subrequest.c \ - $ngx_addon_dir/src/ngx_http_lua_ndk.c \ - $ngx_addon_dir/src/ngx_http_lua_control.c \ - $ngx_addon_dir/src/ngx_http_lua_time.c \ - $ngx_addon_dir/src/ngx_http_lua_misc.c \ - $ngx_addon_dir/src/ngx_http_lua_variable.c \ - $ngx_addon_dir/src/ngx_http_lua_string.c \ - $ngx_addon_dir/src/ngx_http_lua_output.c \ - $ngx_addon_dir/src/ngx_http_lua_headers.c \ - $ngx_addon_dir/src/ngx_http_lua_req_body.c \ - $ngx_addon_dir/src/ngx_http_lua_uri.c \ - $ngx_addon_dir/src/ngx_http_lua_args.c \ - $ngx_addon_dir/src/ngx_http_lua_ctx.c \ - $ngx_addon_dir/src/ngx_http_lua_regex.c \ - $ngx_addon_dir/src/ngx_http_lua_module.c \ - $ngx_addon_dir/src/ngx_http_lua_headers_out.c \ - $ngx_addon_dir/src/ngx_http_lua_headers_in.c \ - $ngx_addon_dir/src/ngx_http_lua_directive.c \ - $ngx_addon_dir/src/ngx_http_lua_consts.c \ - $ngx_addon_dir/src/ngx_http_lua_exception.c \ - $ngx_addon_dir/src/ngx_http_lua_util.c \ - $ngx_addon_dir/src/ngx_http_lua_cache.c \ - $ngx_addon_dir/src/ngx_http_lua_contentby.c \ - $ngx_addon_dir/src/ngx_http_lua_rewriteby.c \ - $ngx_addon_dir/src/ngx_http_lua_accessby.c \ - $ngx_addon_dir/src/ngx_http_lua_setby.c \ - $ngx_addon_dir/src/ngx_http_lua_capturefilter.c \ - $ngx_addon_dir/src/ngx_http_lua_clfactory.c \ - $ngx_addon_dir/src/ngx_http_lua_pcrefix.c \ - $ngx_addon_dir/src/ngx_http_lua_headerfilterby.c \ - $ngx_addon_dir/src/ngx_http_lua_shdict.c \ - $ngx_addon_dir/src/ngx_http_lua_socket_tcp.c \ - $ngx_addon_dir/src/ngx_http_lua_api.c \ - $ngx_addon_dir/src/ngx_http_lua_logby.c \ - $ngx_addon_dir/src/ngx_http_lua_sleep.c \ - $ngx_addon_dir/src/ngx_http_lua_semaphore.c\ - $ngx_addon_dir/src/ngx_http_lua_coroutine.c \ - $ngx_addon_dir/src/ngx_http_lua_bodyfilterby.c \ - $ngx_addon_dir/src/ngx_http_lua_initby.c \ - $ngx_addon_dir/src/ngx_http_lua_initworkerby.c \ - $ngx_addon_dir/src/ngx_http_lua_socket_udp.c \ - $ngx_addon_dir/src/ngx_http_lua_req_method.c \ - $ngx_addon_dir/src/ngx_http_lua_phase.c \ - $ngx_addon_dir/src/ngx_http_lua_uthread.c \ - $ngx_addon_dir/src/ngx_http_lua_timer.c \ - $ngx_addon_dir/src/ngx_http_lua_config.c \ - $ngx_addon_dir/src/ngx_http_lua_worker.c \ - $ngx_addon_dir/src/ngx_http_lua_ssl_certby.c \ - $ngx_addon_dir/src/ngx_http_lua_ssl_ocsp.c \ - $ngx_addon_dir/src/ngx_http_lua_lex.c \ - $ngx_addon_dir/src/ngx_http_lua_balancer.c \ - $ngx_addon_dir/src/ngx_http_lua_ssl_session_storeby.c \ - $ngx_addon_dir/src/ngx_http_lua_ssl_session_fetchby.c \ - $ngx_addon_dir/src/ngx_http_lua_ssl.c \ - $ngx_addon_dir/src/ngx_http_lua_log_ringbuf.c \ - " - -HTTP_LUA_DEPS=" \ - $ngx_addon_dir/src/ddebug.h \ - $ngx_addon_dir/src/ngx_http_lua_script.h \ - $ngx_addon_dir/src/ngx_http_lua_log.h \ - $ngx_addon_dir/src/ngx_http_lua_subrequest.h \ - $ngx_addon_dir/src/ngx_http_lua_ndk.h \ - $ngx_addon_dir/src/ngx_http_lua_control.h \ - $ngx_addon_dir/src/ngx_http_lua_time.h \ - $ngx_addon_dir/src/ngx_http_lua_string.h \ - $ngx_addon_dir/src/ngx_http_lua_misc.h \ - $ngx_addon_dir/src/ngx_http_lua_variable.h \ - $ngx_addon_dir/src/ngx_http_lua_output.h \ - $ngx_addon_dir/src/ngx_http_lua_headers.h \ - $ngx_addon_dir/src/ngx_http_lua_uri.h \ - $ngx_addon_dir/src/ngx_http_lua_req_body.h \ - $ngx_addon_dir/src/ngx_http_lua_args.h \ - $ngx_addon_dir/src/ngx_http_lua_ctx.h \ - $ngx_addon_dir/src/ngx_http_lua_regex.h \ - $ngx_addon_dir/src/ngx_http_lua_common.h \ - $ngx_addon_dir/src/ngx_http_lua_directive.h \ - $ngx_addon_dir/src/ngx_http_lua_headers_out.h \ - $ngx_addon_dir/src/ngx_http_lua_headers_in.h \ - $ngx_addon_dir/src/ngx_http_lua_consts.h \ - $ngx_addon_dir/src/ngx_http_lua_exception.h \ - $ngx_addon_dir/src/ngx_http_lua_util.h \ - $ngx_addon_dir/src/ngx_http_lua_cache.h \ - $ngx_addon_dir/src/ngx_http_lua_contentby.h \ - $ngx_addon_dir/src/ngx_http_lua_rewriteby.h \ - $ngx_addon_dir/src/ngx_http_lua_accessby.h \ - $ngx_addon_dir/src/ngx_http_lua_setby.h \ - $ngx_addon_dir/src/ngx_http_lua_capturefilter.h \ - $ngx_addon_dir/src/ngx_http_lua_clfactory.h \ - $ngx_addon_dir/src/ngx_http_lua_pcrefix.h \ - $ngx_addon_dir/src/ngx_http_lua_headerfilterby.h \ - $ngx_addon_dir/src/ngx_http_lua_shdict.h \ - $ngx_addon_dir/src/ngx_http_lua_socket_tcp.h \ - $ngx_addon_dir/src/api/ngx_http_lua_api.h \ - $ngx_addon_dir/src/ngx_http_lua_logby.h \ - $ngx_addon_dir/src/ngx_http_lua_sleep.h \ - $ngx_addon_dir/src/ngx_http_lua_semaphore.h\ - $ngx_addon_dir/src/ngx_http_lua_coroutine.h \ - $ngx_addon_dir/src/ngx_http_lua_bodyfilterby.h \ - $ngx_addon_dir/src/ngx_http_lua_initby.h \ - $ngx_addon_dir/src/ngx_http_lua_initworkerby.h \ - $ngx_addon_dir/src/ngx_http_lua_socket_udp.h \ - $ngx_addon_dir/src/ngx_http_lua_req_method.h \ - $ngx_addon_dir/src/ngx_http_lua_phase.h \ - $ngx_addon_dir/src/ngx_http_lua_probe.h \ - $ngx_addon_dir/src/ngx_http_lua_uthread.h \ - $ngx_addon_dir/src/ngx_http_lua_timer.h \ - $ngx_addon_dir/src/ngx_http_lua_config.h \ - $ngx_addon_dir/src/ngx_http_lua_worker.h \ - $ngx_addon_dir/src/ngx_http_lua_ssl_certby.h \ - $ngx_addon_dir/src/ngx_http_lua_lex.h \ - $ngx_addon_dir/src/ngx_http_lua_balancer.h \ - $ngx_addon_dir/src/ngx_http_lua_ssl_session_storeby.h \ - $ngx_addon_dir/src/ngx_http_lua_ssl_session_fetchby.h \ - $ngx_addon_dir/src/ngx_http_lua_ssl.h \ - $ngx_addon_dir/src/ngx_http_lua_log_ringbuf.h \ - " - -CFLAGS="$CFLAGS -DNDK_SET_VAR" - -ngx_feature="export symbols by default (-E)" -ngx_feature_libs="-Wl,-E" -ngx_feature_name= -ngx_feature_run=no -ngx_feature_incs="#include " -ngx_feature_path= -ngx_feature_test='printf("hello");' - -. auto/feature - -if [ $ngx_found = yes ]; then - CORE_LIBS="-Wl,-E $CORE_LIBS" -fi - -# for Cygwin -ngx_feature="export symbols by default (--export-all-symbols)" -ngx_feature_libs="-Wl,--export-all-symbols" -ngx_feature_name= -ngx_feature_run=no -ngx_feature_incs="#include " -ngx_feature_path= -ngx_feature_test='printf("hello");' - -. auto/feature - -if [ $ngx_found = yes ]; then - CORE_LIBS="-Wl,--export-all-symbols $CORE_LIBS" -fi - -NGX_DTRACE_PROVIDERS="$NGX_DTRACE_PROVIDERS $ngx_addon_dir/dtrace/ngx_lua_provider.d" -NGX_TAPSET_SRCS="$NGX_TAPSET_SRCS $ngx_addon_dir/tapset/ngx_lua.stp" - -USE_MD5=YES -USE_SHA1=YES - -CORE_INCS="$CORE_INCS $ngx_addon_dir/src/api" - -ngx_feature="SO_PASSCRED" -ngx_feature_libs= -ngx_feature_name="NGX_HTTP_LUA_HAVE_SO_PASSCRED" -ngx_feature_run=no -ngx_feature_incs="#include -#include " -ngx_feature_path= -ngx_feature_test='setsockopt(1, SOL_SOCKET, SO_PASSCRED, NULL, 0);' - -. auto/feature - -ngx_feature="__attribute__(constructor)" -ngx_feature_libs= -ngx_feature_name="NGX_HTTP_LUA_HAVE_CONSTRUCTOR" -ngx_feature_run=yes -ngx_feature_incs="#include -int a = 2; -__attribute__((constructor)) -static void foo(void) -{ - a = 0; -} -" -ngx_feature_test="exit(a);" -SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" -CC_TEST_FLAGS="-Werror -Wall $CC_TEST_FLAGS" - -. auto/feature - -CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" - -# ---------------------------------------- - -ngx_feature="malloc_trim" -ngx_feature_libs= -ngx_feature_name="NGX_HTTP_LUA_HAVE_MALLOC_TRIM" -ngx_feature_run=yes -ngx_feature_incs="#include -#include " -ngx_feature_test="int rc = malloc_trim((size_t) 0); printf(\"%d\", rc);" -SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS" -CC_TEST_FLAGS="-Werror -Wall $CC_TEST_FLAGS" - -. auto/feature - -CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS" - -# ---------------------------------------- - -if test -n "$ngx_module_link"; then - ngx_module_type=HTTP_AUX_FILTER - ngx_module_name=$ngx_addon_name - ngx_module_deps="$HTTP_LUA_DEPS" - ngx_module_srcs="$HTTP_LUA_SRCS" - - . auto/module -else - HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES $ngx_addon_name" - NGX_ADDON_SRCS="$NGX_ADDON_SRCS $HTTP_LUA_SRCS" - NGX_ADDON_DEPS="$NGX_ADDON_DEPS $HTTP_LUA_DEPS" - - CORE_INCS="$CORE_INCS $ngx_module_incs" - CORE_LIBS="$CORE_LIBS $ngx_module_libs" -fi - -#CFLAGS=$"$CFLAGS -DLUA_DEFAULT_PATH='\"/usr/local/openresty/lualib/?.lua\"'" -#CFLAGS=$"$CFLAGS -DLUA_DEFAULT_CPATH='\"/usr/local/openresty/lualib/?.so\"'" diff -Nru nginx-1.18.0/debian/modules/http-lua/doc/HttpLuaModule.wiki nginx-1.18.0/debian/modules/http-lua/doc/HttpLuaModule.wiki --- nginx-1.18.0/debian/modules/http-lua/doc/HttpLuaModule.wiki 2020-05-28 20:03:01.000000000 +0000 +++ nginx-1.18.0/debian/modules/http-lua/doc/HttpLuaModule.wiki 1970-01-01 00:00:00.000000000 +0000 @@ -1,7073 +0,0 @@ -= Name = - -ngx_http_lua_module - Embed the power of Lua into Nginx HTTP Servers. - -''This module is not distributed with the Nginx source.'' See [[#Installation|the installation instructions]]. - -= Status = - -Production ready. - -= Version = - -This document describes ngx_lua [https://github.com/openresty/lua-nginx-module/tags v0.10.13] released on 22 April 2018. - -= Synopsis = - - # set search paths for pure Lua external libraries (';;' is the default path): - lua_package_path '/foo/bar/?.lua;/blah/?.lua;;'; - - # set search paths for Lua external libraries written in C (can also use ';;'): - lua_package_cpath '/bar/baz/?.so;/blah/blah/?.so;;'; - - server { - location /lua_content { - # MIME type determined by default_type: - default_type 'text/plain'; - - content_by_lua_block { - ngx.say('Hello,world!') - } - } - - location /nginx_var { - # MIME type determined by default_type: - default_type 'text/plain'; - - # try access /nginx_var?a=hello,world - content_by_lua_block { - ngx.say(ngx.var.arg_a) - } - } - - location = /request_body { - client_max_body_size 50k; - client_body_buffer_size 50k; - - content_by_lua_block { - ngx.req.read_body() -- explicitly read the req body - local data = ngx.req.get_body_data() - if data then - ngx.say("body data:") - ngx.print(data) - return - end - - -- body may get buffered in a temp file: - local file = ngx.req.get_body_file() - if file then - ngx.say("body is in file ", file) - else - ngx.say("no body found") - end - } - } - - # transparent non-blocking I/O in Lua via subrequests - # (well, a better way is to use cosockets) - location = /lua { - # MIME type determined by default_type: - default_type 'text/plain'; - - content_by_lua_block { - local res = ngx.location.capture("/some_other_location") - if res then - ngx.say("status: ", res.status) - ngx.say("body:") - ngx.print(res.body) - end - } - } - - location = /foo { - rewrite_by_lua_block { - res = ngx.location.capture("/memc", - { args = { cmd = "incr", key = ngx.var.uri } } - ) - } - - proxy_pass http://blah.blah.com; - } - - location = /mixed { - rewrite_by_lua_file /path/to/rewrite.lua; - access_by_lua_file /path/to/access.lua; - content_by_lua_file /path/to/content.lua; - } - - # use nginx var in code path - # CAUTION: contents in nginx var must be carefully filtered, - # otherwise there'll be great security risk! - location ~ ^/app/([-_a-zA-Z0-9/]+) { - set $path $1; - content_by_lua_file /path/to/lua/app/root/$path.lua; - } - - location / { - client_max_body_size 100k; - client_body_buffer_size 100k; - - access_by_lua_block { - -- check the client IP address is in our black list - if ngx.var.remote_addr == "132.5.72.3" then - ngx.exit(ngx.HTTP_FORBIDDEN) - end - - -- check if the URI contains bad words - if ngx.var.uri and - string.match(ngx.var.request_body, "evil") - then - return ngx.redirect("/terms_of_use.html") - end - - -- tests passed - } - - # proxy_pass/fastcgi_pass/etc settings - } - } - - -= Description = - -This module embeds Lua, via the standard Lua 5.1 interpreter or [http://luajit.org/luajit.html LuaJIT 2.0/2.1], into Nginx and by leveraging Nginx's subrequests, allows the integration of the powerful Lua threads (Lua coroutines) into the Nginx event model. - -Unlike [https://httpd.apache.org/docs/trunk/mod/mod_lua.html Apache's mod_lua] and [http://redmine.lighttpd.net/wiki/1/Docs:ModMagnet Lighttpd's mod_magnet], Lua code executed using this module can be ''100% non-blocking'' on network traffic as long as the [[#Nginx API for Lua|Nginx API for Lua]] provided by this module is used to handle -requests to upstream services such as MySQL, PostgreSQL, Memcached, Redis, or upstream HTTP web services. - -At least the following Lua libraries and Nginx modules can be used with this ngx_lua module: - -* [https://github.com/openresty/lua-resty-memcached lua-resty-memcached] -* [https://github.com/openresty/lua-resty-mysql lua-resty-mysql] -* [https://github.com/openresty/lua-resty-redis lua-resty-redis] -* [https://github.com/openresty/lua-resty-dns lua-resty-dns] -* [https://github.com/openresty/lua-resty-upload lua-resty-upload] -* [https://github.com/openresty/lua-resty-websocket lua-resty-websocket] -* [https://github.com/openresty/lua-resty-lock lua-resty-lock] -* [https://github.com/cloudflare/lua-resty-logger-socket lua-resty-logger-socket] -* [https://github.com/openresty/lua-resty-lrucache lua-resty-lrucache] -* [https://github.com/openresty/lua-resty-string lua-resty-string] -* [[HttpMemcModule|ngx_memc]] -* [https://github.com/FRiCKLE/ngx_postgres ngx_postgres] -* [[HttpRedis2Module|ngx_redis2]] -* [[HttpRedisModule|ngx_redis]] -* [[HttpProxyModule|ngx_proxy]] -* [[HttpFastcgiModule|ngx_fastcgi]] - -Almost all the Nginx modules can be used with this ngx_lua module by means of [[#ngx.location.capture|ngx.location.capture]] or [[#ngx.location.capture_multi|ngx.location.capture_multi]] but it is recommended to use those lua-resty-* libraries instead of creating subrequests to access the Nginx upstream modules because the former is usually much more flexible and memory-efficient. - -The Lua interpreter or LuaJIT instance is shared across all the requests in a single nginx worker process but request contexts are segregated using lightweight Lua coroutines. - -Loaded Lua modules persist in the nginx worker process level resulting in a small memory footprint in Lua even when under heavy loads. - -This module is plugged into NGINX's "http" subsystem so it can only speaks downstream communication protocols in the HTTP family (HTTP 0.9/1.0/1.1/2.0, WebSockets, and etc). -If you want to do generic TCP communications with the downstream clients, then you should use the [https://github.com/openresty/stream-lua-nginx-module#readme ngx_stream_lua] module instead -which has a compatible Lua API. - -= Typical Uses = - -Just to name a few: - -* Mashup'ing and processing outputs of various nginx upstream outputs (proxy, drizzle, postgres, redis, memcached, and etc) in Lua, -* doing arbitrarily complex access control and security checks in Lua before requests actually reach the upstream backends, -* manipulating response headers in an arbitrary way (by Lua) -* fetching backend information from external storage backends (like redis, memcached, mysql, postgresql) and use that information to choose which upstream backend to access on-the-fly, -* coding up arbitrarily complex web applications in a content handler using synchronous but still non-blocking access to the database backends and other storage, -* doing very complex URL dispatch in Lua at rewrite phase, -* using Lua to implement advanced caching mechanism for Nginx's subrequests and arbitrary locations. - -The possibilities are unlimited as the module allows bringing together various elements within Nginx as well as exposing the power of the Lua language to the user. The module provides the full flexibility of scripting while offering performance levels comparable with native C language programs both in terms of CPU time as well as memory footprint. This is particularly the case when LuaJIT 2.x is enabled. - -Other scripting language implementations typically struggle to match this performance level. - -The Lua state (Lua VM instance) is shared across all the requests handled by a single nginx worker process to minimize memory use. - -= Nginx Compatibility = - -The latest version of this module is compatible with the following versions of Nginx: - -* 1.13.x (last tested: 1.13.6) -* 1.12.x -* 1.11.x (last tested: 1.11.2) -* 1.10.x -* 1.9.x (last tested: 1.9.15) -* 1.8.x -* 1.7.x (last tested: 1.7.10) -* 1.6.x - -Nginx cores older than 1.6.0 (exclusive) are *not* supported. - -= Installation = - -It is *highly* recommended to use [http://openresty.org OpenResty releases] which integrate Nginx, ngx_lua, LuaJIT 2.1, as well as other powerful companion Nginx modules and Lua libraries. It is discouraged to build this module with nginx yourself since it is tricky to set up exactly right. Also, the stock nginx cores have various limitations and long standing bugs that can make some of this modules' features become disabled, not work properly, or run slower. The same applies to LuaJIT as well. OpenResty includes its own version of LuaJIT which gets specifically optimized and enhanced for the OpenResty environment. - -Alternatively, ngx_lua can be manually compiled into Nginx: - -# Install LuaJIT 2.0 or 2.1 (recommended) or Lua 5.1 (Lua 5.2 is ''not'' supported yet). LuaJIT can be downloaded from the [http://luajit.org/download.html LuaJIT project website] and Lua 5.1, from the [http://www.lua.org/ Lua project website]. Some distribution package managers also distribute LuaJIT and/or Lua. -# Download the latest version of the ngx_devel_kit (NDK) module [https://github.com/simplresty/ngx_devel_kit/tags HERE]. -# Download the latest version of ngx_lua [https://github.com/openresty/lua-nginx-module/tags HERE]. -# Download the latest version of Nginx [http://nginx.org/ HERE] (See [[#Nginx Compatibility|Nginx Compatibility]]) - -Build the source with this module: - - - wget 'http://nginx.org/download/nginx-1.13.6.tar.gz' - tar -xzvf nginx-1.13.6.tar.gz - cd nginx-1.13.6/ - - # tell nginx's build system where to find LuaJIT 2.0: - export LUAJIT_LIB=/path/to/luajit/lib - export LUAJIT_INC=/path/to/luajit/include/luajit-2.0 - - # tell nginx's build system where to find LuaJIT 2.1: - export LUAJIT_LIB=/path/to/luajit/lib - export LUAJIT_INC=/path/to/luajit/include/luajit-2.1 - - # or tell where to find Lua if using Lua instead: - #export LUA_LIB=/path/to/lua/lib - #export LUA_INC=/path/to/lua/include - - # Here we assume Nginx is to be installed under /opt/nginx/. - ./configure --prefix=/opt/nginx \ - --with-ld-opt="-Wl,-rpath,/path/to/luajit-or-lua/lib" \ - --add-module=/path/to/ngx_devel_kit \ - --add-module=/path/to/lua-nginx-module - - # Note that you may also want to add `./configure` options which are used in your - # current nginx build. - # You can get usually those options using command nginx -V - - # you can change the parallism number 2 below to fit the number of spare CPU cores in your - # machine. - make -j2 - make install - - -== Building as a dynamic module == - -Starting from NGINX 1.9.11, you can also compile this module as a dynamic module, by using the --add-dynamic-module=PATH option instead of --add-module=PATH on the -./configure command line above. And then you can explicitly load the module in your nginx.conf via the [load_module](http://nginx.org/en/docs/ngx_core_module.html#load_module) -directive, for example, - - -load_module /path/to/modules/ndk_http_module.so; # assuming NDK is built as a dynamic module too -load_module /path/to/modules/ngx_http_lua_module.so; - - -== C Macro Configurations == - -While building this module either via OpenResty or with the NGINX core, you can define the following C macros via the C compiler options: - -* NGX_LUA_USE_ASSERT -: When defined, will enable assertions in the ngx_lua C code base. Recommended for debugging or testing builds. It can introduce some (small) runtime overhead when enabled. This macro was first introduced in the v0.9.10 release. -* NGX_LUA_ABORT_AT_PANIC -: When the Lua/LuaJIT VM panics, ngx_lua will instruct the current nginx worker process to quit gracefully by default. By specifying this C macro, ngx_lua will abort the current nginx worker process (which usually result in a core dump file) immediately. This option is useful for debugging VM panics. This option was first introduced in the v0.9.8 release. -* NGX_LUA_NO_FFI_API -: Excludes pure C API functions for FFI-based Lua API for NGINX (as required by [https://github.com/openresty/lua-resty-core#readme lua-resty-core], for example). Enabling this macro can make the resulting binary code size smaller. - -To enable one or more of these macros, just pass extra C compiler options to the ./configure script of either NGINX or OpenResty. For instance, - - - ./configure --with-cc-opt="-DNGX_LUA_USE_ASSERT -DNGX_LUA_ABORT_AT_PANIC" - - -== Installation on Ubuntu 11.10 == - -Note that it is recommended to use LuaJIT 2.0 or LuaJIT 2.1 instead of the standard Lua 5.1 interpreter wherever possible. - -If the standard Lua 5.1 interpreter is required however, run the following command to install it from the Ubuntu repository: - - -apt-get install -y lua5.1 liblua5.1-0 liblua5.1-0-dev - - -Everything should be installed correctly, except for one small tweak. - -Library name liblua.so has been changed in liblua5.1 package, it only comes with liblua5.1.so, which needs to be symlinked to /usr/lib so it could be found during the configuration process. - - -ln -s /usr/lib/x86_64-linux-gnu/liblua5.1.so /usr/lib/liblua.so - - -= Community = - -== English Mailing List == - -The [https://groups.google.com/group/openresty-en openresty-en] mailing list is for English speakers. - -== Chinese Mailing List == - -The [https://groups.google.com/group/openresty openresty] mailing list is for Chinese speakers. - -= Code Repository = - -The code repository of this project is hosted on github at [https://github.com/openresty/lua-nginx-module openresty/lua-nginx-module]. - -= Bugs and Patches = - -Please submit bug reports, wishlists, or patches by - -# creating a ticket on the [https://github.com/openresty/lua-nginx-module/issues GitHub Issue Tracker], -# or posting to the [[#Community|OpenResty community]]. - -= Lua/LuaJIT bytecode support = - -As from the v0.5.0rc32 release, all *_by_lua_file configure directives (such as [[#content_by_lua_file|content_by_lua_file]]) support loading Lua 5.1 and LuaJIT 2.0/2.1 raw bytecode files directly. - -Please note that the bytecode format used by LuaJIT 2.0/2.1 is not compatible with that used by the standard Lua 5.1 interpreter. So if using LuaJIT 2.0/2.1 with ngx_lua, LuaJIT compatible bytecode files must be generated as shown: - - - /path/to/luajit/bin/luajit -b /path/to/input_file.lua /path/to/output_file.ljbc - - -The -bg option can be used to include debug information in the LuaJIT bytecode file: - - - /path/to/luajit/bin/luajit -bg /path/to/input_file.lua /path/to/output_file.ljbc - - -Please refer to the official LuaJIT documentation on the -b option for more details: - -http://luajit.org/running.html#opt_b - -Also, the bytecode files generated by LuaJIT 2.1 is ''not'' compatible with LuaJIT 2.0, and vice versa. The support for LuaJIT 2.1 bytecode was first added in ngx_lua v0.9.3. - -Similarly, if using the standard Lua 5.1 interpreter with ngx_lua, Lua compatible bytecode files must be generated using the luac commandline utility as shown: - - - luac -o /path/to/output_file.luac /path/to/input_file.lua - - -Unlike as with LuaJIT, debug information is included in standard Lua 5.1 bytecode files by default. This can be striped out by specifying the -s option as shown: - - - luac -s -o /path/to/output_file.luac /path/to/input_file.lua - - -Attempts to load standard Lua 5.1 bytecode files into ngx_lua instances linked to LuaJIT 2.0/2.1 or vice versa, will result in an error message, such as that below, being logged into the Nginx error.log file: - - - [error] 13909#0: *1 failed to load Lua inlined code: bad byte-code header in /path/to/test_file.luac - - -Loading bytecode files via the Lua primitives like require and dofile should always work as expected. - -= System Environment Variable Support = - -If you want to access the system environment variable, say, foo, in Lua via the standard Lua API [http://www.lua.org/manual/5.1/manual.html#pdf-os.getenv os.getenv], then you should also list this environment variable name in your nginx.conf file via the [http://nginx.org/en/docs/ngx_core_module.html#env env directive]. For example, - - - env foo; - - -= HTTP 1.0 support = - -The HTTP 1.0 protocol does not support chunked output and requires an explicit Content-Length header when the response body is not empty in order to support the HTTP 1.0 keep-alive. -So when a HTTP 1.0 request is made and the [[#lua_http10_buffering|lua_http10_buffering]] directive is turned on, ngx_lua will buffer the -output of [[#ngx.say|ngx.say]] and [[#ngx.print|ngx.print]] calls and also postpone sending response headers until all the response body output is received. -At that time ngx_lua can calculate the total length of the body and construct a proper Content-Length header to return to the HTTP 1.0 client. -If the Content-Length response header is set in the running Lua code, however, this buffering will be disabled even if the [[#lua_http10_buffering|lua_http10_buffering]] directive is turned on. - -For large streaming output responses, it is important to disable the [[#lua_http10_buffering|lua_http10_buffering]] directive to minimise memory usage. - -Note that common HTTP benchmark tools such as ab and http_load issue HTTP 1.0 requests by default. -To force curl to send HTTP 1.0 requests, use the -0 option. - -= Statically Linking Pure Lua Modules = - -When LuaJIT 2.x is used, it is possible to statically link the bytecode of pure Lua modules into the Nginx executable. - -Basically you use the luajit executable to compile .lua Lua module files to .o object files containing the exported bytecode data, and then link the .o files directly in your Nginx build. - -Below is a trivial example to demonstrate this. Consider that we have the following .lua file named foo.lua: - - - -- foo.lua - local _M = {} - - function _M.go() - print("Hello from foo") - end - - return _M - - -And then we compile this .lua file to foo.o file: - - /path/to/luajit/bin/luajit -bg foo.lua foo.o - -What matters here is the name of the .lua file, which determines how you use this module later on the Lua land. The file name foo.o does not matter at all except the .o file extension (which tells luajit what output format is used). If you want to strip the Lua debug information from the resulting bytecode, you can just specify the -b option above instead of -bg. - -Then when building Nginx or OpenResty, pass the --with-ld-opt="foo.o" option to the ./configure script: - - - ./configure --with-ld-opt="/path/to/foo.o" ... - - -Finally, you can just do the following in any Lua code run by ngx_lua: - - - local foo = require "foo" - foo.go() - - -And this piece of code no longer depends on the external foo.lua file any more because it has already been compiled into the nginx executable. - -If you want to use dot in the Lua module name when calling require, as in - - - local foo = require "resty.foo" - - -then you need to rename the foo.lua file to resty_foo.lua before compiling it down to a .o file with the luajit command-line utility. - -It is important to use exactly the same version of LuaJIT when compiling .lua files to .o files as building nginx + ngx_lua. This is because the LuaJIT bytecode format may be incompatible between different LuaJIT versions. When the bytecode format is incompatible, you will see a Lua runtime error saying that the Lua module is not found. - -When you have multiple .lua files to compile and link, then just specify their .o files at the same time in the value of the --with-ld-opt option. For instance, - - - ./configure --with-ld-opt="/path/to/foo.o /path/to/bar.o" ... - - -If you have just too many .o files, then it might not be feasible to name them all in a single command. In this case, you can build a static library (or archive) for your .o files, as in - - - ar rcus libmyluafiles.a *.o - - -then you can link the myluafiles archive as a whole to your nginx executable: - - - ./configure \ - --with-ld-opt="-L/path/to/lib -Wl,--whole-archive -lmyluafiles -Wl,--no-whole-archive" - - -where /path/to/lib is the path of the directory containing the libmyluafiles.a file. It should be noted that the linker option --whole-archive is required here because otherwise our archive will be skipped because no symbols in our archive are mentioned in the main parts of the nginx executable. - -= Data Sharing within an Nginx Worker = - -To globally share data among all the requests handled by the same nginx worker process, encapsulate the shared data into a Lua module, use the Lua require builtin to import the module, and then manipulate the shared data in Lua. This works because required Lua modules are loaded only once and all coroutines will share the same copy of the module (both its code and data). Note however that Lua global variables (note, not module-level variables) WILL NOT persist between requests because of the one-coroutine-per-request isolation design. - -Here is a complete small example: - - - -- mydata.lua - local _M = {} - - local data = { - dog = 3, - cat = 4, - pig = 5, - } - - function _M.get_age(name) - return data[name] - end - - return _M - - -and then accessing it from nginx.conf: - - - location /lua { - content_by_lua_block { - local mydata = require "mydata" - ngx.say(mydata.get_age("dog")) - } - } - - -The mydata module in this example will only be loaded and run on the first request to the location /lua, -and all subsequent requests to the same nginx worker process will use the reloaded instance of the -module as well as the same copy of the data in it, until a HUP signal is sent to the Nginx master process to force a reload. -This data sharing technique is essential for high performance Lua applications based on this module. - -Note that this data sharing is on a ''per-worker'' basis and not on a ''per-server'' basis. That is, when there are multiple nginx worker processes under an Nginx master, data sharing cannot cross the process boundary between these workers. - -It is usually recommended to share read-only data this way. You can also share changeable data among all the concurrent requests of each nginx worker process as -long as there is ''no'' nonblocking I/O operations (including [[#ngx.sleep|ngx.sleep]]) -in the middle of your calculations. As long as you do not give the -control back to the nginx event loop and ngx_lua's light thread -scheduler (even implicitly), there can never be any race conditions in -between. For this reason, always be very careful when you want to share changeable data on the -worker level. Buggy optimizations can easily lead to hard-to-debug -race conditions under load. - -If server-wide data sharing is required, then use one or more of the following approaches: - -# Use the [[#ngx.shared.DICT|ngx.shared.DICT]] API provided by this module. -# Use only a single nginx worker and a single server (this is however not recommended when there is a multi core CPU or multiple CPUs in a single machine). -# Use data storage mechanisms such as memcached, redis, MySQL or PostgreSQL. [http://openresty.org The OpenResty bundle] associated with this module comes with a set of companion Nginx modules and Lua libraries that provide interfaces with these data storage mechanisms. - -= Known Issues = - -== TCP socket connect operation issues == -The [[#tcpsock:connect|tcpsock:connect]] method may indicate success despite connection failures such as with Connection Refused errors. - -However, later attempts to manipulate the cosocket object will fail and return the actual error status message generated by the failed connect operation. - -This issue is due to limitations in the Nginx event model and only appears to affect Mac OS X. - -== Lua Coroutine Yielding/Resuming == -* Because Lua's dofile and require builtins are currently implemented as C functions in both Lua 5.1 and LuaJIT 2.0/2.1, if the Lua file being loaded by dofile or require invokes [[#ngx.location.capture|ngx.location.capture*]], [[#ngx.exec|ngx.exec]], [[#ngx.exit|ngx.exit]], or other API functions requiring yielding in the *top-level* scope of the Lua file, then the Lua error "attempt to yield across C-call boundary" will be raised. To avoid this, put these calls requiring yielding into your own Lua functions in the Lua file instead of the top-level scope of the file. -* As the standard Lua 5.1 interpreter's VM is not fully resumable, the methods [[#ngx.location.capture|ngx.location.capture]], [[#ngx.location.capture_multi|ngx.location.capture_multi]], [[#ngx.redirect|ngx.redirect]], [[#ngx.exec|ngx.exec]], and [[#ngx.exit|ngx.exit]] cannot be used within the context of a Lua [http://www.lua.org/manual/5.1/manual.html#pdf-pcall pcall()] or [http://www.lua.org/manual/5.1/manual.html#pdf-xpcall xpcall()] or even the first line of the for ... in ... statement when the standard Lua 5.1 interpreter is used and the attempt to yield across metamethod/C-call boundary error will be produced. Please use LuaJIT 2.x, which supports a fully resumable VM, to avoid this. - -== Lua Variable Scope == -Care must be taken when importing modules and this form should be used: - - - local xxx = require('xxx') - - -instead of the old deprecated form: - - - require('xxx') - - -Here is the reason: by design, the global environment has exactly the same lifetime as the Nginx request handler associated with it. Each request handler has its own set of Lua global variables and that is the idea of request isolation. The Lua module is actually loaded by the first Nginx request handler and is cached by the require() built-in in the package.loaded table for later reference, and the module() builtin used by some Lua modules has the side effect of setting a global variable to the loaded module table. But this global variable will be cleared at the end of the request handler, and every subsequent request handler all has its own (clean) global environment. So one will get Lua exception for accessing the nil value. - -The use of Lua global variables is a generally inadvisable in the ngx_lua context as: - -# the misuse of Lua globals has detrimental side effects on concurrent requests when such variables should instead be local in scope, -# Lua global variables require Lua table look-ups in the global environment which is computationally expensive, and -# some Lua global variable references may include typing errors which make such difficult to debug. - -It is therefore *highly* recommended to always declare such within an appropriate local scope instead. - - - -- Avoid - foo = 123 - -- Recommended - local foo = 123 - - -- Avoid - function foo() return 123 end - -- Recommended - local function foo() return 123 end - - - -To find all instances of Lua global variables in your Lua code, run the [https://github.com/openresty/nginx-devel-utils/blob/master/lua-releng lua-releng tool] across all .lua source files: - -$ lua-releng -Checking use of Lua global variables in file lib/foo/bar.lua ... - 1 [1489] SETGLOBAL 7 -1 ; contains - 55 [1506] GETGLOBAL 7 -3 ; setvar - 3 [1545] GETGLOBAL 3 -4 ; varexpand - -The output says that the line 1489 of file lib/foo/bar.lua writes to a global variable named contains, the line 1506 reads from the global variable setvar, and line 1545 reads the global varexpand. - -This tool will guarantee that local variables in the Lua module functions are all declared with the local keyword, otherwise a runtime exception will be thrown. It prevents undesirable race conditions while accessing such variables. See [[#Data_Sharing_within_an_Nginx_Worker|Data Sharing within an Nginx Worker]] for the reasons behind this. - -== Locations Configured by Subrequest Directives of Other Modules == -The [[#ngx.location.capture|ngx.location.capture]] and [[#ngx.location.capture_multi|ngx.location.capture_multi]] directives cannot capture locations that include the [[HttpAdditionModule#add_before_body|add_before_body]], [[HttpAdditionModule#add_after_body|add_after_body]], [http://nginx.org/en/docs/http/ngx_http_auth_request_module.html#auth_request auth_request], [[HttpEchoModule#echo_location|echo_location]], [[HttpEchoModule#echo_location_async|echo_location_async]], [[HttpEchoModule#echo_subrequest|echo_subrequest]], or [[HttpEchoModule#echo_subrequest_async|echo_subrequest_async]] directives. - - - location /foo { - content_by_lua_block { - res = ngx.location.capture("/bar") - } - } - location /bar { - echo_location /blah; - } - location /blah { - echo "Success!"; - } - - - - $ curl -i http://example.com/foo - - -will not work as expected. - -== Cosockets Not Available Everywhere == - -Due to internal limitations in the nginx core, the cosocket API is disabled in the following contexts: [[#set_by_lua|set_by_lua*]], [[#log_by_lua|log_by_lua*]], [[#header_filter_by_lua|header_filter_by_lua*]], and [[#body_filter_by_lua|body_filter_by_lua]]. - -The cosockets are currently also disabled in the [[#init_by_lua|init_by_lua*]] and [[#init_worker_by_lua|init_worker_by_lua*]] directive contexts but we may add support for these contexts in the future because there is no limitation in the nginx core (or the limitation might be worked around). - -There exists a work-around, however, when the original context does *not* need to wait for the cosocket results. That is, creating a zero-delay timer via the [[#ngx.timer.at|ngx.timer.at]] API and do the cosocket results in the timer handler, which runs asynchronously as to the original context creating the timer. - -== Special Escaping Sequences == - -'''NOTE''' Following the v0.9.17 release, this pitfall can be avoided by using the *_by_lua_block {} configuration directives. - -PCRE sequences such as \d, \s, or \w, require special attention because in string literals, the backslash character, \, is stripped out by both the Lua language parser and by the nginx config file parser before processing if not within a *_by_lua_block {} directive. So the following snippet will not work as expected: - - - # nginx.conf - ? location /test { - ? content_by_lua ' - ? local regex = "\d+" -- THIS IS WRONG OUTSIDE OF A *_by_lua_block DIRECTIVE - ? local m = ngx.re.match("hello, 1234", regex) - ? if m then ngx.say(m[0]) else ngx.say("not matched!") end - ? '; - ? } - # evaluates to "not matched!" - - -To avoid this, ''double'' escape the backslash: - - - # nginx.conf - location /test { - content_by_lua ' - local regex = "\\\\d+" - local m = ngx.re.match("hello, 1234", regex) - if m then ngx.say(m[0]) else ngx.say("not matched!") end - '; - } - # evaluates to "1234" - - -Here, \\\\d+ is stripped down to \\d+ by the Nginx config file parser and this is further stripped down to \d+ by the Lua language parser before running. - -Alternatively, the regex pattern can be presented as a long-bracketed Lua string literal by encasing it in "long brackets", [[...]], in which case backslashes have to only be escaped once for the Nginx config file parser. - - - # nginx.conf - location /test { - content_by_lua ' - local regex = [[\\d+]] - local m = ngx.re.match("hello, 1234", regex) - if m then ngx.say(m[0]) else ngx.say("not matched!") end - '; - } - # evaluates to "1234" - - -Here, [[\\d+]] is stripped down to [[\d+]] by the Nginx config file parser and this is processed correctly. - -Note that a longer from of the long bracket, [=[...]=], may be required if the regex pattern contains [...] sequences. -The [=[...]=] form may be used as the default form if desired. - - - # nginx.conf - location /test { - content_by_lua ' - local regex = [=[[0-9]+]=] - local m = ngx.re.match("hello, 1234", regex) - if m then ngx.say(m[0]) else ngx.say("not matched!") end - '; - } - # evaluates to "1234" - - -An alternative approach to escaping PCRE sequences is to ensure that Lua code is placed in external script files and executed using the various *_by_lua_file directives. -With this approach, the backslashes are only stripped by the Lua language parser and therefore only need to be escaped once each. - - - -- test.lua - local regex = "\\d+" - local m = ngx.re.match("hello, 1234", regex) - if m then ngx.say(m[0]) else ngx.say("not matched!") end - -- evaluates to "1234" - - -Within external script files, PCRE sequences presented as long-bracketed Lua string literals do not require modification. - - - -- test.lua - local regex = [[\d+]] - local m = ngx.re.match("hello, 1234", regex) - if m then ngx.say(m[0]) else ngx.say("not matched!") end - -- evaluates to "1234" - - -As noted earlier, PCRE sequences presented within *_by_lua_block {} directives (available following the v0.9.17 release) do not require modification. - - - # nginx.conf - location /test { - content_by_lua_block { - local regex = [[\d+]] - local m = ngx.re.match("hello, 1234", regex) - if m then ngx.say(m[0]) else ngx.say("not matched!") end - } - } - # evaluates to "1234" - - - -== Mixing with SSI Not Supported == - -Mixing SSI with ngx_lua in the same Nginx request is not supported at all. Just use ngx_lua exclusively. Everything you can do with SSI can be done atop ngx_lua anyway and it can be more efficient when using ngx_lua. - -== SPDY Mode Not Fully Supported == - -Certain Lua APIs provided by ngx_lua do not work in Nginx's SPDY mode yet: [[#ngx.location.capture|ngx.location.capture]], [[#ngx.location.capture_multi|ngx.location.capture_multi]], and [[#ngx.req.socket|ngx.req.socket]]. - -== Missing data on short circuited requests == - -Nginx may terminate a request early with (at least): - -* 400 (Bad Request) -* 405 (Not Allowed) -* 408 (Request Timeout) -* 413 (Request Entity Too Large) -* 414 (Request URI Too Large) -* 494 (Request Headers Too Large) -* 499 (Client Closed Request) -* 500 (Internal Server Error) -* 501 (Not Implemented) - -This means that phases that normally run are skipped, such as the rewrite or -access phase. This also means that later phases that are run regardless, e.g. -[[#log_by_lua|log_by_lua]], will not have access to information that is normally set in those -phases. - -= TODO = - -* cosocket: implement LuaSocket's unconnected UDP API. -* port this module to the "datagram" subsystem of NGINX for implementing general UDP servers instead of HTTP -servers in Lua. For example, - - datagram { - server { - listen 1953; - handler_by_lua_block { - -- custom Lua code implementing the special UDP server... - } - } - } - -* shm: implement a "shared queue API" to complement the existing [[#lua_shared_dict|shared dict]] API. -* cosocket: add support in the context of [[#init_by_lua|init_by_lua*]]. -* cosocket: implement the bind() method for stream-typed cosockets. -* cosocket: pool-based backend concurrency level control: implement automatic connect queueing when the backend concurrency exceeds its connection pool limit. -* cosocket: review and merge aviramc's [https://github.com/openresty/lua-nginx-module/pull/290 patch] for adding the bsdrecv method. -* add new API function ngx.resp.add_header to emulate the standard add_header config directive. -* review and apply vadim-pavlov's patch for [[#ngx.location.capture|ngx.location.capture]]'s extra_headers option -* use ngx_hash_t to optimize the built-in header look-up process for [[#ngx.req.set_header|ngx.req.set_header]], [[#ngx.header.HEADER|ngx.header.HEADER]], and etc. -* add configure options for different strategies of handling the cosocket connection exceeding in the pools. -* add directives to run Lua codes when nginx stops. -* add ignore_resp_headers, ignore_resp_body, and ignore_resp options to [[#ngx.location.capture|ngx.location.capture]] and [[#ngx.location.capture_multi|ngx.location.capture_multi]] methods, to allow micro performance tuning on the user side. -* add automatic Lua code time slicing support by yielding and resuming the Lua VM actively via Lua's debug hooks. -* add stat mode similar to [https://httpd.apache.org/docs/trunk/mod/mod_lua.html mod_lua]. -* cosocket: add client SSL certificate support. - -= Changes = - -The changes made in every release of this module are listed in the change logs of the OpenResty bundle: - -http://openresty.org/#Changes - -= Test Suite = - -The following dependencies are required to run the test suite: - -* Nginx version >= 1.4.2 - -* Perl modules: -** Test::Nginx: https://github.com/openresty/test-nginx - -* Nginx modules: -** [https://github.com/simplresty/ngx_devel_kit ngx_devel_kit] -** [https://github.com/openresty/set-misc-nginx-module ngx_set_misc] -** [http://mdounin.ru/files/ngx_http_auth_request_module-0.2.tar.gz ngx_auth_request] (this is not needed if you're using Nginx 1.5.4+. -** [https://github.com/openresty/echo-nginx-module ngx_echo] -** [https://github.com/openresty/memc-nginx-module ngx_memc] -** [https://github.com/openresty/srcache-nginx-module ngx_srcache] -** ngx_lua (i.e., this module) -** [https://github.com/openresty/lua-upstream-nginx-module ngx_lua_upstream] -** [https://github.com/openresty/headers-more-nginx-module ngx_headers_more] -** [https://github.com/openresty/drizzle-nginx-module ngx_drizzle] -** [https://github.com/openresty/rds-json-nginx-module ngx_rds_json] -** [https://github.com/FRiCKLE/ngx_coolkit ngx_coolkit] -** [https://github.com/openresty/redis2-nginx-module ngx_redis2] - -The order in which these modules are added during configuration is important because the position of any filter module in the -filtering chain determines the final output, for example. The correct adding order is shown above. - -* 3rd-party Lua libraries: -** [http://www.kyne.com.au/~mark/software/lua-cjson.php lua-cjson] - -* Applications: -** mysql: create database 'ngx_test', grant all privileges to user 'ngx_test', password is 'ngx_test' -** memcached: listening on the default port, 11211. -** redis: listening on the default port, 6379. - -See also the [https://github.com/openresty/lua-nginx-module/blob/master/util/build.sh developer build script] for more details on setting up the testing environment. - -To run the whole test suite in the default testing mode: - - cd /path/to/lua-nginx-module - export PATH=/path/to/your/nginx/sbin:$PATH - prove -I/path/to/test-nginx/lib -r t - - -To run specific test files: - - cd /path/to/lua-nginx-module - export PATH=/path/to/your/nginx/sbin:$PATH - prove -I/path/to/test-nginx/lib t/002-content.t t/003-errors.t - - -To run a specific test block in a particular test file, add the line --- ONLY to the test block you want to run, and then use the prove utility to run that .t file. - -There are also various testing modes based on mockeagain, valgrind, and etc. Refer to the [http://search.cpan.org/perldoc?Test::Nginx Test::Nginx documentation] for more details for various advanced testing modes. See also the test reports for the Nginx test cluster running on Amazon EC2: http://qa.openresty.org. - -= Copyright and License = - -This module is licensed under the BSD license. - -Copyright (C) 2009-2017, by Xiaozhe Wang (chaoslawful) . - -Copyright (C) 2009-2018, by Yichun "agentzh" Zhang (章亦春) , OpenResty Inc. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -= See Also = - -* [https://github.com/openresty/stream-lua-nginx-module#readme ngx_stream_lua_module] for an official port of this module for the NGINX "stream" subsystem (doing generic downstream TCP communications). -* [https://github.com/openresty/lua-resty-memcached lua-resty-memcached] library based on ngx_lua cosocket. -* [https://github.com/openresty/lua-resty-redis lua-resty-redis] library based on ngx_lua cosocket. -* [https://github.com/openresty/lua-resty-mysql lua-resty-mysql] library based on ngx_lua cosocket. -* [https://github.com/openresty/lua-resty-upload lua-resty-upload] library based on ngx_lua cosocket. -* [https://github.com/openresty/lua-resty-dns lua-resty-dns] library based on ngx_lua cosocket. -* [https://github.com/openresty/lua-resty-websocket lua-resty-websocket] library for both WebSocket server and client, based on ngx_lua cosocket. -* [https://github.com/openresty/lua-resty-string lua-resty-string] library based on [http://luajit.org/ext_ffi.html LuaJIT FFI]. -* [https://github.com/openresty/lua-resty-lock lua-resty-lock] library for a nonblocking simple lock API. -* [https://github.com/cloudflare/lua-resty-cookie lua-resty-cookie] library for HTTP cookie manipulation. -* [http://openresty.org/#RoutingMySQLQueriesBasedOnURIArgs Routing requests to different MySQL queries based on URI arguments] -* [http://openresty.org/#DynamicRoutingBasedOnRedis Dynamic Routing Based on Redis and Lua] -* [http://openresty.org/#UsingLuaRocks Using LuaRocks with ngx_lua] -* [https://github.com/openresty/lua-nginx-module/wiki/Introduction Introduction to ngx_lua] -* [https://github.com/simplresty/ngx_devel_kit ngx_devel_kit] -* [[HttpEchoModule]] -* [[HttpDrizzleModule]] -* [https://github.com/FRiCKLE/ngx_postgres postgres-nginx-module] -* [[HttpMemcModule]] -* [http://openresty.org The OpenResty bundle] -* [https://github.com/openresty/nginx-systemtap-toolkit Nginx Systemtap Toolkit] - -= Directives = - - - -The basic building blocks of scripting Nginx with Lua are directives. Directives are used to specify when the user Lua code is run and -how the result will be used. Below is a diagram showing the order in which directives are executed. - -![Lua Nginx Modules Directives](https://cloud.githubusercontent.com/assets/2137369/15272097/77d1c09e-1a37-11e6-97ef-d9767035fc3e.png) - -== lua_capture_error_log == -'''syntax:''' ''lua_capture_error_log size'' - -'''default:''' ''none'' - -'''context:''' ''http'' - -Enables a buffer of the specified size for capturing all the nginx error log message data (not just those produced -by this module or the nginx http subsystem, but everything) without touching files or disks. - -You can use units like `k` and `m` in the size value, as in - - - lua_capture_error_log 100k; - - -As a rule of thumb, a 4KB buffer can usually hold about 20 typical error log messages. So do the maths! - -This buffer never grows. If it is full, new error log messages will replace the oldest ones in the buffer. - -The size of the buffer must be bigger than the maximum length of a single error log message (which is 4K in OpenResty and 2K in stock NGINX). - -You can read the messages in the buffer on the Lua land via the -[https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/errlog.md#get_logs get_logs()] -function of the -[https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/errlog.md#readme ngx.errlog] -module of the [https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/errlog.md#readme lua-resty-core] -library. This Lua API function will return the captured error log messages and -also remove these already read from the global capturing buffer, making room -for any new error log data. For this reason, the user should not configure this -buffer to be too big if the user read the buffered error log data fast enough. - -Note that the log level specified in the standard [http://nginx.org/r/error_log error_log] directive -''does'' have effect on this capturing facility. It only captures log -messages of a level no lower than the specified log level in the [http://nginx.org/r/error_log error_log] directive. -The user can still choose to set an even higher filtering log level on the fly via the Lua API function -[https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/errlog.md#set_filter_level errlog.set_filter_level]. -So it is more flexible than the static [http://nginx.org/r/error_log error_log] directive. - -It is worth noting that there is no way to capture the debugging logs -without building OpenResty or NGINX with the ./configure -option --with-debug. And enabling debugging logs is -strongly discouraged in production builds due to high overhead. - -This directive was first introduced in the v0.10.9 release. - -== lua_use_default_type == -'''syntax:''' ''lua_use_default_type on | off'' - -'''default:''' ''lua_use_default_type on'' - -'''context:''' ''http, server, location, location if'' - -Specifies whether to use the MIME type specified by the [http://nginx.org/en/docs/http/ngx_http_core_module.html#default_type default_type] directive for the default value of the Content-Type response header. Deactivate this directive if a default Content-Type response header for Lua request handlers is not desired. - -This directive is turned on by default. - -This directive was first introduced in the v0.9.1 release. - -== lua_malloc_trim == -'''syntax:''' ''lua_malloc_trim '' - -'''default:''' ''lua_malloc_trim 1000'' - -'''context:''' ''http'' - -Asks the underlying libc runtime library to release its cached free memory back to the operating system every -N requests processed by the NGINX core. By default, N is 1000. You can configure the request count -by using your own numbers. Smaller numbers mean more frequent releases, which may introduce higher CPU time consumption and -smaller memory footprint while larger numbers usually lead to less CPU time overhead and relatively larger memory footprint. -Just tune the number for your own use cases. - -Configuring the argument to 0 essentially turns off the periodical memory trimming altogether. - - - lua_malloc_trim 0; # turn off trimming completely - - -The current implementation uses an NGINX log phase handler to do the request counting. So the appearance of the -[http://nginx.org/en/docs/http/ngx_http_core_module.html#log_subrequest log_subrequest on] directives in nginx.conf -may make the counting faster when subrequests are involved. By default, only "main requests" count. - -Note that this directive does *not* affect the memory allocated by LuaJIT's own allocator based on the mmap -system call. - -This directive was first introduced in the v0.10.7 release. - -== lua_code_cache == -'''syntax:''' ''lua_code_cache on | off'' - -'''default:''' ''lua_code_cache on'' - -'''context:''' ''http, server, location, location if'' - -Enables or disables the Lua code cache for Lua code in *_by_lua_file directives (like [[#set_by_lua_file|set_by_lua_file]] and -[[#content_by_lua_file|content_by_lua_file]]) and Lua modules. - -When turning off, every request served by ngx_lua will run in a separate Lua VM instance, starting from the 0.9.3 release. So the Lua files referenced in [[#set_by_lua_file|set_by_lua_file]], -[[#content_by_lua_file|content_by_lua_file]], [[#access_by_lua_file|access_by_lua_file]], -and etc will not be cached -and all Lua modules used will be loaded from scratch. With this in place, developers can adopt an edit-and-refresh approach. - -Please note however, that Lua code written inlined within nginx.conf -such as those specified by [[#set_by_lua|set_by_lua]], [[#content_by_lua|content_by_lua]], -[[#access_by_lua|access_by_lua]], and [[#rewrite_by_lua|rewrite_by_lua]] will not be updated when you edit the inlined Lua code in your nginx.conf file because only the Nginx config file parser can correctly parse the nginx.conf -file and the only way is to reload the config file -by sending a HUP signal or just to restart Nginx. - -Even when the code cache is enabled, Lua files which are loaded by dofile or loadfile -in *_by_lua_file cannot be cached (unless you cache the results yourself). Usually you can either use the [[#init_by_lua|init_by_lua]] -or [[#init-by_lua_file|init_by_lua_file]] directives to load all such files or just make these Lua files true Lua modules -and load them via require. - -The ngx_lua module does not support the stat mode available with the -Apache mod_lua module (yet). - -Disabling the Lua code cache is strongly -discouraged for production use and should only be used during -development as it has a significant negative impact on overall performance. For example, the performance of a "hello world" Lua example can drop by an order of magnitude after disabling the Lua code cache. - -== lua_regex_cache_max_entries == -'''syntax:''' ''lua_regex_cache_max_entries '' - -'''default:''' ''lua_regex_cache_max_entries 1024'' - -'''context:''' ''http'' - -Specifies the maximum number of entries allowed in the worker process level compiled regex cache. - -The regular expressions used in [[#ngx.re.match|ngx.re.match]], [[#ngx.re.gmatch|ngx.re.gmatch]], [[#ngx.re.sub|ngx.re.sub]], and [[#ngx.re.gsub|ngx.re.gsub]] will be cached within this cache if the regex option o (i.e., compile-once flag) is specified. - -The default number of entries allowed is 1024 and when this limit is reached, new regular expressions will not be cached (as if the o option was not specified) and there will be one, and only one, warning in the error.log file: - - - 2011/08/27 23:18:26 [warn] 31997#0: *1 lua exceeding regex cache max entries (1024), ... - - -If you are using the ngx.re.* implementation of [lua-resty-core](https://github.com/openresty/lua-resty-core) by loading the resty.core.regex module (or just the resty.core module), then an LRU cache is used for the regex cache being used here. - -Do not activate the o option for regular expressions (and/or replace string arguments for [[#ngx.re.sub|ngx.re.sub]] and [[#ngx.re.gsub|ngx.re.gsub]]) that are generated ''on the fly'' and give rise to infinite variations to avoid hitting the specified limit. - -== lua_regex_match_limit == -'''syntax:''' ''lua_regex_match_limit '' - -'''default:''' ''lua_regex_match_limit 0'' - -'''context:''' ''http'' - -Specifies the "match limit" used by the PCRE library when executing the [[#ngx.re.match|ngx.re API]]. To quote the PCRE manpage, "the limit ... has the effect of limiting the amount of backtracking that can take place." - -When the limit is hit, the error string "pcre_exec() failed: -8" will be returned by the [[#ngx.re.match|ngx.re API]] functions on the Lua land. - -When setting the limit to 0, the default "match limit" when compiling the PCRE library is used. And this is the default value of this directive. - -This directive was first introduced in the v0.8.5 release. - -== lua_package_path == - -'''syntax:''' ''lua_package_path '' - -'''default:''' ''The content of LUA_PATH environment variable or Lua's compiled-in defaults.'' - -'''context:''' ''http'' - -Sets the Lua module search path used by scripts specified by [[#set_by_lua|set_by_lua]], -[[#content_by_lua|content_by_lua]] and others. The path string is in standard Lua path form, and ;; -can be used to stand for the original search paths. - -As from the v0.5.0rc29 release, the special notation $prefix or ${prefix} can be used in the search path string to indicate the path of the server prefix usually determined by the -p PATH command-line option while starting the Nginx server. - -== lua_package_cpath == - -'''syntax:''' ''lua_package_cpath '' - -'''default:''' ''The content of LUA_CPATH environment variable or Lua's compiled-in defaults.'' - -'''context:''' ''http'' - -Sets the Lua C-module search path used by scripts specified by [[#set_by_lua|set_by_lua]], -[[#content_by_lua|content_by_lua]] and others. The cpath string is in standard Lua cpath form, and ;; -can be used to stand for the original cpath. - -As from the v0.5.0rc29 release, the special notation $prefix or ${prefix} can be used in the search path string to indicate the path of the server prefix usually determined by the -p PATH command-line option while starting the Nginx server. - -== init_by_lua == - -'''syntax:''' ''init_by_lua '' - -'''context:''' ''http'' - -'''phase:''' ''loading-config'' - -'''NOTE''' Use of this directive is ''discouraged'' following the v0.9.17 release. Use the [[#init_by_lua_block|init_by_lua_block]] directive instead. - -Runs the Lua code specified by the argument on the global Lua VM level when the Nginx master process (if any) is loading the Nginx config file. - -When Nginx receives the HUP signal and starts reloading the config file, the Lua VM will also be re-created and init_by_lua will run again on the new Lua VM. In case that the [[#lua_code_cache|lua_code_cache]] directive is turned off (default on), the init_by_lua handler will run upon every request because in this special mode a standalone Lua VM is always created for each request. - -Usually you can pre-load Lua modules at server start-up by means of this hook and take advantage of modern operating systems' copy-on-write (COW) optimization. Here is an example for pre-loading Lua modules: - - - # this runs before forking out nginx worker processes: - init_by_lua_block { require "cjson" } - - server { - location = /api { - content_by_lua_block { - -- the following require() will just return - -- the alrady loaded module from package.loaded: - ngx.say(require "cjson".encode{dog = 5, cat = 6}) - } - } - } - - -You can also initialize the [[#lua_shared_dict|lua_shared_dict]] shm storage at this phase. Here is an example for this: - - - lua_shared_dict dogs 1m; - - init_by_lua_block { - local dogs = ngx.shared.dogs; - dogs:set("Tom", 56) - } - - server { - location = /api { - content_by_lua_block { - local dogs = ngx.shared.dogs; - ngx.say(dogs:get("Tom")) - } - } - } - - -But note that, the [[#lua_shared_dict|lua_shared_dict]]'s shm storage will not be cleared through a config reload (via the HUP signal, for example). So if you do ''not'' want to re-initialize the shm storage in your init_by_lua code in this case, then you just need to set a custom flag in the shm storage and always check the flag in your init_by_lua code. - -Because the Lua code in this context runs before Nginx forks its worker processes (if any), data or code loaded here will enjoy the [http://en.wikipedia.org/wiki/Copy-on-write Copy-on-write (COW)] feature provided by many operating systems among all the worker processes, thus saving a lot of memory. - -Do *not* initialize your own Lua global variables in this context because use of Lua global variables have performance penalties and can lead to global namespace pollution (see the [[#Lua_Variable_Scope|Lua Variable Scope]] section for more details). The recommended way is to use proper [http://www.lua.org/manual/5.1/manual.html#5.3 Lua module] files (but do not use the standard Lua function [http://www.lua.org/manual/5.1/manual.html#pdf-module module()] to define Lua modules because it pollutes the global namespace as well) and call [http://www.lua.org/manual/5.1/manual.html#pdf-require require()] to load your own module files in init_by_lua or other contexts ([http://www.lua.org/manual/5.1/manual.html#pdf-require require()] does cache the loaded Lua modules in the global package.loaded table in the Lua registry so your modules will only loaded once for the whole Lua VM instance). - -Only a small set of the [[#Nginx API for Lua|Nginx API for Lua]] is supported in this context: - -* Logging APIs: [[#ngx.log|ngx.log]] and [[#print|print]], -* Shared Dictionary API: [[#ngx.shared.DICT|ngx.shared.DICT]]. - -More Nginx APIs for Lua may be supported in this context upon future user requests. - -Basically you can safely use Lua libraries that do blocking I/O in this very context because blocking the master process during server start-up is completely okay. Even the Nginx core does blocking I/O (at least on resolving upstream's host names) at the configure-loading phase. - -You should be very careful about potential security vulnerabilities in your Lua code registered in this context because the Nginx master process is often run under the root account. - -This directive was first introduced in the v0.5.5 release. - -== init_by_lua_block == - -'''syntax:''' ''init_by_lua_block { lua-script }'' - -'''context:''' ''http'' - -'''phase:''' ''loading-config'' - -Similar to the [[#init_by_lua|init_by_lua]] directive except that this directive inlines -the Lua source directly -inside a pair of curly braces ({}) instead of in an NGINX string literal (which requires -special character escaping). - -For instance, - - - init_by_lua_block { - print("I need no extra escaping here, for example: \r\nblah") - } - - -This directive was first introduced in the v0.9.17 release. - -== init_by_lua_file == - -'''syntax:''' ''init_by_lua_file '' - -'''context:''' ''http'' - -'''phase:''' ''loading-config'' - -Equivalent to [[#init_by_lua|init_by_lua]], except that the file specified by contains the Lua code or [[#Lua/LuaJIT bytecode support|Lua/LuaJIT bytecode]] to be executed. - -When a relative path like foo/bar.lua is given, they will be turned into the absolute path relative to the server prefix path determined by the -p PATH command-line option while starting the Nginx server. - -This directive was first introduced in the v0.5.5 release. - -== init_worker_by_lua == - -'''syntax:''' ''init_worker_by_lua '' - -'''context:''' ''http'' - -'''phase:''' ''starting-worker'' - -'''NOTE''' Use of this directive is ''discouraged'' following the v0.9.17 release. Use the [[#init_worker_by_lua_block|init_worker_by_lua_block]] directive instead. - -Runs the specified Lua code upon every Nginx worker process's startup when the master process is enabled. When the master process is disabled, this hook will just run after [[#init_by_lua|init_by_lua*]]. - -This hook is often used to create per-worker reoccurring timers (via the [[#ngx.timer.at|ngx.timer.at]] Lua API), either for backend health-check or other timed routine work. Below is an example, - - - init_worker_by_lua ' - local delay = 3 -- in seconds - local new_timer = ngx.timer.at - local log = ngx.log - local ERR = ngx.ERR - local check - - check = function(premature) - if not premature then - -- do the health check or other routine work - local ok, err = new_timer(delay, check) - if not ok then - log(ERR, "failed to create timer: ", err) - return - end - end - end - - local hdl, err = new_timer(delay, check) - if not hdl then - log(ERR, "failed to create timer: ", err) - return - end - '; - - -This directive was first introduced in the v0.9.5 release. - -This hook no longer runs in the cache manager and cache loader processes since the v0.10.12 release. - -== init_worker_by_lua_block == - -'''syntax:''' ''init_worker_by_lua_block { lua-script }'' - -'''context:''' ''http'' - -'''phase:''' ''starting-worker'' - -Similar to the [[#init_worker_by_lua|init_worker_by_lua]] directive except that this directive inlines -the Lua source directly -inside a pair of curly braces ({}) instead of in an NGINX string literal (which requires -special character escaping). - -For instance, - - - init_worker_by_lua_block { - print("I need no extra escaping here, for example: \r\nblah") - } - - -This directive was first introduced in the v0.9.17 release. - -This hook no longer runs in the cache manager and cache loader processes since the v0.10.12 release. - -== init_worker_by_lua_file == - -'''syntax:''' ''init_worker_by_lua_file '' - -'''context:''' ''http'' - -'''phase:''' ''starting-worker'' - -Similar to [[#init_worker_by_lua|init_worker_by_lua]], but accepts the file path to a Lua source file or Lua bytecode file. - -This directive was first introduced in the v0.9.5 release. - -This hook no longer runs in the cache manager and cache loader processes since the v0.10.12 release. - -== set_by_lua == - -'''syntax:''' ''set_by_lua $res [$arg1 $arg2 ...]'' - -'''context:''' ''server, server if, location, location if'' - -'''phase:''' ''rewrite'' - -'''NOTE''' Use of this directive is ''discouraged'' following the v0.9.17 release. Use the [[#set_by_lua_block|set_by_lua_block]] directive instead. - -Executes code specified in with optional input arguments $arg1 $arg2 ..., and returns string output to $res. -The code in can make [[#Nginx API for Lua|API calls]] and can retrieve input arguments from the ngx.arg table (index starts from 1 and increases sequentially). - -This directive is designed to execute short, fast running code blocks as the Nginx event loop is blocked during code execution. Time consuming code sequences should therefore be avoided. - -This directive is implemented by injecting custom commands into the standard [[HttpRewriteModule]]'s command list. Because [[HttpRewriteModule]] does not support nonblocking I/O in its commands, Lua APIs requiring yielding the current Lua "light thread" cannot work in this directive. - -At least the following API functions are currently disabled within the context of set_by_lua: - -* Output API functions (e.g., [[#ngx.say|ngx.say]] and [[#ngx.send_headers|ngx.send_headers]]) -* Control API functions (e.g., [[#ngx.exit|ngx.exit]]) -* Subrequest API functions (e.g., [[#ngx.location.capture|ngx.location.capture]] and [[#ngx.location.capture_multi|ngx.location.capture_multi]]) -* Cosocket API functions (e.g., [[#ngx.socket.tcp|ngx.socket.tcp]] and [[#ngx.req.socket|ngx.req.socket]]). -* Sleeping API function [[#ngx.sleep|ngx.sleep]]. - -In addition, note that this directive can only write out a value to a single Nginx variable at -a time. However, a workaround is possible using the [[#ngx.var.VARIABLE|ngx.var.VARIABLE]] interface. - - - location /foo { - set $diff ''; # we have to predefine the $diff variable here - - set_by_lua $sum ' - local a = 32 - local b = 56 - - ngx.var.diff = a - b; -- write to $diff directly - return a + b; -- return the $sum value normally - '; - - echo "sum = $sum, diff = $diff"; - } - - -This directive can be freely mixed with all directives of the [[HttpRewriteModule]], [[HttpSetMiscModule]], and [[HttpArrayVarModule]] modules. All of these directives will run in the same order as they appear in the config file. - - - set $foo 32; - set_by_lua $bar 'return tonumber(ngx.var.foo) + 1'; - set $baz "bar: $bar"; # $baz == "bar: 33" - - -As from the v0.5.0rc29 release, Nginx variable interpolation is disabled in the argument of this directive and therefore, the dollar sign character ($) can be used directly. - -This directive requires the [https://github.com/simplresty/ngx_devel_kit ngx_devel_kit] module. - -== set_by_lua_block == - -'''syntax:''' ''set_by_lua_block $res { lua-script }'' - -'''context:''' ''server, server if, location, location if'' - -'''phase:''' ''rewrite'' - -Similar to the [[#set_by_lua|set_by_lua]] directive except that - -# this directive inlines the Lua source directly -inside a pair of curly braces ({}) instead of in an NGINX string literal (which requires -special character escaping), and -# this directive does not support extra arguments after the Lua script as in [[#set_by_lua|set_by_lua]]. - -For example, - - - set_by_lua_block $res { return 32 + math.cos(32) } - # $res now has the value "32.834223360507" or alike. - - -No special escaping is required in the Lua code block. - -This directive was first introduced in the v0.9.17 release. - -== set_by_lua_file == -'''syntax:''' ''set_by_lua_file $res [$arg1 $arg2 ...]'' - -'''context:''' ''server, server if, location, location if'' - -'''phase:''' ''rewrite'' - -Equivalent to [[#set_by_lua|set_by_lua]], except that the file specified by contains the Lua code, or, as from the v0.5.0rc32 release, the [[#Lua/LuaJIT bytecode support|Lua/LuaJIT bytecode]] to be executed. - -Nginx variable interpolation is supported in the argument string of this directive. But special care must be taken for injection attacks. - -When a relative path like foo/bar.lua is given, they will be turned into the absolute path relative to the server prefix path determined by the -p PATH command-line option while starting the Nginx server. - -When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached -and the Nginx config must be reloaded each time the Lua source file is modified. -The Lua code cache can be temporarily disabled during development by -switching [[#lua_code_cache|lua_code_cache]] off in nginx.conf to avoid reloading Nginx. - -This directive requires the [https://github.com/simplresty/ngx_devel_kit ngx_devel_kit] module. - -== content_by_lua == - -'''syntax:''' ''content_by_lua '' - -'''context:''' ''location, location if'' - -'''phase:''' ''content'' - -'''NOTE''' Use of this directive is ''discouraged'' following the v0.9.17 release. Use the [[#content_by_lua_block|content_by_lua_block]] directive instead. - -Acts as a "content handler" and executes Lua code string specified in for every request. -The Lua code may make [[#Nginx API for Lua|API calls]] and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox). - -Do not use this directive and other content handler directives in the same location. For example, this directive and the [[HttpProxyModule#proxy_pass|proxy_pass]] directive should not be used in the same location. - -== content_by_lua_block == - -'''syntax:''' ''content_by_lua_block { lua-script }'' - -'''context:''' ''location, location if'' - -'''phase:''' ''content'' - -Similar to the [[#content_by_lua|content_by_lua]] directive except that this directive inlines -the Lua source directly -inside a pair of curly braces ({}) instead of in an NGINX string literal (which requires -special character escaping). - -For instance, - - - content_by_lua_block { - ngx.say("I need no extra escaping here, for example: \r\nblah") - } - - -This directive was first introduced in the v0.9.17 release. - -== content_by_lua_file == - -'''syntax:''' ''content_by_lua_file '' - -'''context:''' ''location, location if'' - -'''phase:''' ''content'' - -Equivalent to [[#content_by_lua|content_by_lua]], except that the file specified by contains the Lua code, or, as from the v0.5.0rc32 release, the [[#Lua/LuaJIT bytecode support|Lua/LuaJIT bytecode]] to be executed. - -Nginx variables can be used in the string to provide flexibility. This however carries some risks and is not ordinarily recommended. - -When a relative path like foo/bar.lua is given, they will be turned into the absolute path relative to the server prefix path determined by the -p PATH command-line option while starting the Nginx server. - -When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached -and the Nginx config must be reloaded each time the Lua source file is modified. -The Lua code cache can be temporarily disabled during development by -switching [[#lua_code_cache|lua_code_cache]] off in nginx.conf to avoid reloading Nginx. - -Nginx variables are supported in the file path for dynamic dispatch, for example: - - - # CAUTION: contents in nginx var must be carefully filtered, - # otherwise there'll be great security risk! - location ~ ^/app/([-_a-zA-Z0-9/]+) { - set $path $1; - content_by_lua_file /path/to/lua/app/root/$path.lua; - } - - -But be very careful about malicious user inputs and always carefully validate or filter out the user-supplied path components. - -== rewrite_by_lua == - -'''syntax:''' ''rewrite_by_lua '' - -'''context:''' ''http, server, location, location if'' - -'''phase:''' ''rewrite tail'' - -'''NOTE''' Use of this directive is ''discouraged'' following the v0.9.17 release. Use the [[#rewrite_by_lua_block|rewrite_by_lua_block]] directive instead. - -Acts as a rewrite phase handler and executes Lua code string specified in for every request. -The Lua code may make [[#Nginx API for Lua|API calls]] and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox). - -Note that this handler always runs ''after'' the standard [[HttpRewriteModule]]. So the following will work as expected: - - - location /foo { - set $a 12; # create and initialize $a - set $b ""; # create and initialize $b - rewrite_by_lua 'ngx.var.b = tonumber(ngx.var.a) + 1'; - echo "res = $b"; - } - - -because set $a 12 and set $b "" run ''before'' [[#rewrite_by_lua|rewrite_by_lua]]. - -On the other hand, the following will not work as expected: - - - ? location /foo { - ? set $a 12; # create and initialize $a - ? set $b ''; # create and initialize $b - ? rewrite_by_lua 'ngx.var.b = tonumber(ngx.var.a) + 1'; - ? if ($b = '13') { - ? rewrite ^ /bar redirect; - ? break; - ? } - ? - ? echo "res = $b"; - ? } - - -because if runs ''before'' [[#rewrite_by_lua|rewrite_by_lua]] even if it is placed after [[#rewrite_by_lua|rewrite_by_lua]] in the config. - -The right way of doing this is as follows: - - - location /foo { - set $a 12; # create and initialize $a - set $b ''; # create and initialize $b - rewrite_by_lua ' - ngx.var.b = tonumber(ngx.var.a) + 1 - if tonumber(ngx.var.b) == 13 then - return ngx.redirect("/bar"); - end - '; - - echo "res = $b"; - } - - -Note that the [http://www.grid.net.ru/nginx/eval.en.html ngx_eval] module can be approximated by using [[#rewrite_by_lua|rewrite_by_lua]]. For example, - - - location / { - eval $res { - proxy_pass http://foo.com/check-spam; - } - - if ($res = 'spam') { - rewrite ^ /terms-of-use.html redirect; - } - - fastcgi_pass ...; - } - - -can be implemented in ngx_lua as: - - - location = /check-spam { - internal; - proxy_pass http://foo.com/check-spam; - } - - location / { - rewrite_by_lua ' - local res = ngx.location.capture("/check-spam") - if res.body == "spam" then - return ngx.redirect("/terms-of-use.html") - end - '; - - fastcgi_pass ...; - } - - -Just as any other rewrite phase handlers, [[#rewrite_by_lua|rewrite_by_lua]] also runs in subrequests. - -Note that when calling ngx.exit(ngx.OK) within a [[#rewrite_by_lua|rewrite_by_lua]] handler, the nginx request processing control flow will still continue to the content handler. To terminate the current request from within a [[#rewrite_by_lua|rewrite_by_lua]] handler, calling [[#ngx.exit|ngx.exit]] with status >= 200 (ngx.HTTP_OK) and status < 300 (ngx.HTTP_SPECIAL_RESPONSE) for successful quits and ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR) (or its friends) for failures. - -If the [[HttpRewriteModule]]'s [[HttpRewriteModule#rewrite|rewrite]] directive is used to change the URI and initiate location re-lookups (internal redirections), then any [[#rewrite_by_lua|rewrite_by_lua]] or [[#rewrite_by_lua_file|rewrite_by_lua_file]] code sequences within the current location will not be executed. For example, - - - location /foo { - rewrite ^ /bar; - rewrite_by_lua 'ngx.exit(503)'; - } - location /bar { - ... - } - - -Here the Lua code ngx.exit(503) will never run. This will be the case if rewrite ^ /bar last is used as this will similarly initiate an internal redirection. If the break modifier is used instead, there will be no internal redirection and the rewrite_by_lua code will be executed. - -The rewrite_by_lua code will always run at the end of the rewrite request-processing phase unless [[#rewrite_by_lua_no_postpone|rewrite_by_lua_no_postpone]] is turned on. - -== rewrite_by_lua_block == - -'''syntax:''' ''rewrite_by_lua_block { lua-script }'' - -'''context:''' ''http, server, location, location if'' - -'''phase:''' ''rewrite tail'' - -Similar to the [[#rewrite_by_lua|rewrite_by_lua]] directive except that this directive inlines -the Lua source directly -inside a pair of curly braces ({}) instead of in an NGINX string literal (which requires -special character escaping). - -For instance, - - - rewrite_by_lua_block { - do_something("hello, world!\nhiya\n") - } - - -This directive was first introduced in the v0.9.17 release. - -== rewrite_by_lua_file == - -'''syntax:''' ''rewrite_by_lua_file '' - -'''context:''' ''http, server, location, location if'' - -'''phase:''' ''rewrite tail'' - -Equivalent to [[#rewrite_by_lua|rewrite_by_lua]], except that the file specified by contains the Lua code, or, as from the v0.5.0rc32 release, the [[#Lua/LuaJIT bytecode support|Lua/LuaJIT bytecode]] to be executed. - -Nginx variables can be used in the string to provide flexibility. This however carries some risks and is not ordinarily recommended. - -When a relative path like foo/bar.lua is given, they will be turned into the absolute path relative to the server prefix path determined by the -p PATH command-line option while starting the Nginx server. - -When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached and the Nginx config must be reloaded each time the Lua source file is modified. The Lua code cache can be temporarily disabled during development by switching [[#lua_code_cache|lua_code_cache]] off in nginx.conf to avoid reloading Nginx. - -The rewrite_by_lua_file code will always run at the end of the rewrite request-processing phase unless [[#rewrite_by_lua_no_postpone|rewrite_by_lua_no_postpone]] is turned on. - -Nginx variables are supported in the file path for dynamic dispatch just as in [[#content_by_lua_file|content_by_lua_file]]. - -== access_by_lua == - -'''syntax:''' ''access_by_lua '' - -'''context:''' ''http, server, location, location if'' - -'''phase:''' ''access tail'' - -'''NOTE''' Use of this directive is ''discouraged'' following the v0.9.17 release. Use the [[#access_by_lua_block|access_by_lua_block]] directive instead. - -Acts as an access phase handler and executes Lua code string specified in for every request. -The Lua code may make [[#Nginx API for Lua|API calls]] and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox). - -Note that this handler always runs ''after'' the standard [[HttpAccessModule]]. So the following will work as expected: - - - location / { - deny 192.168.1.1; - allow 192.168.1.0/24; - allow 10.1.1.0/16; - deny all; - - access_by_lua ' - local res = ngx.location.capture("/mysql", { ... }) - ... - '; - - # proxy_pass/fastcgi_pass/... - } - - -That is, if a client IP address is in the blacklist, it will be denied before the MySQL query for more complex authentication is executed by [[#access_by_lua|access_by_lua]]. - -Note that the [http://mdounin.ru/hg/ngx_http_auth_request_module/ ngx_auth_request] module can be approximated by using [[#access_by_lua|access_by_lua]]: - - - location / { - auth_request /auth; - - # proxy_pass/fastcgi_pass/postgres_pass/... - } - - -can be implemented in ngx_lua as: - - - location / { - access_by_lua ' - local res = ngx.location.capture("/auth") - - if res.status == ngx.HTTP_OK then - return - end - - if res.status == ngx.HTTP_FORBIDDEN then - ngx.exit(res.status) - end - - ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR) - '; - - # proxy_pass/fastcgi_pass/postgres_pass/... - } - - -As with other access phase handlers, [[#access_by_lua|access_by_lua]] will ''not'' run in subrequests. - -Note that when calling ngx.exit(ngx.OK) within a [[#access_by_lua|access_by_lua]] handler, the nginx request processing control flow will still continue to the content handler. To terminate the current request from within a [[#access_by_lua|access_by_lua]] handler, calling [[#ngx.exit|ngx.exit]] with status >= 200 (ngx.HTTP_OK) and status < 300 (ngx.HTTP_SPECIAL_RESPONSE) for successful quits and ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR) (or its friends) for failures. - -Starting from the v0.9.20 release, you can use the [[#access_by_lua_no_postpone|access_by_lua_no_postpone]] -directive to control when to run this handler inside the "access" request-processing phase -of NGINX. - -== access_by_lua_block == - -'''syntax:''' ''access_by_lua_block { lua-script }'' - -'''context:''' ''http, server, location, location if'' - -'''phase:''' ''access tail'' - -Similar to the [[#access_by_lua|access_by_lua]] directive except that this directive inlines -the Lua source directly -inside a pair of curly braces ({}) instead of in an NGINX string literal (which requires -special character escaping). - -For instance, - - - access_by_lua_block { - do_something("hello, world!\nhiya\n") - } - - -This directive was first introduced in the v0.9.17 release. - -== access_by_lua_file == - -'''syntax:''' ''access_by_lua_file '' - -'''context:''' ''http, server, location, location if'' - -'''phase:''' ''access tail'' - -Equivalent to [[#access_by_lua|access_by_lua]], except that the file specified by contains the Lua code, or, as from the v0.5.0rc32 release, the [[#Lua/LuaJIT bytecode support|Lua/LuaJIT bytecode]] to be executed. - -Nginx variables can be used in the string to provide flexibility. This however carries some risks and is not ordinarily recommended. - -When a relative path like foo/bar.lua is given, they will be turned into the absolute path relative to the server prefix path determined by the -p PATH command-line option while starting the Nginx server. - -When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached -and the Nginx config must be reloaded each time the Lua source file is modified. -The Lua code cache can be temporarily disabled during development by switching [[#lua_code_cache|lua_code_cache]] off in nginx.conf to avoid repeatedly reloading Nginx. - -Nginx variables are supported in the file path for dynamic dispatch just as in [[#content_by_lua_file|content_by_lua_file]]. - -== header_filter_by_lua == - -'''syntax:''' ''header_filter_by_lua '' - -'''context:''' ''http, server, location, location if'' - -'''phase:''' ''output-header-filter'' - -'''NOTE''' Use of this directive is ''discouraged'' following the v0.9.17 release. Use the [[#header_filter_by_lua_block|header_filter_by_lua_block]] directive instead. - -Uses Lua code specified in to define an output header filter. - -Note that the following API functions are currently disabled within this context: - -* Output API functions (e.g., [[#ngx.say|ngx.say]] and [[#ngx.send_headers|ngx.send_headers]]) -* Control API functions (e.g., [[#ngx.redirect|ngx.redirect]] and [[#ngx.exec|ngx.exec]]) -* Subrequest API functions (e.g., [[#ngx.location.capture|ngx.location.capture]] and [[#ngx.location.capture_multi|ngx.location.capture_multi]]) -* Cosocket API functions (e.g., [[#ngx.socket.tcp|ngx.socket.tcp]] and [[#ngx.req.socket|ngx.req.socket]]). - -Here is an example of overriding a response header (or adding one if absent) in our Lua header filter: - - - location / { - proxy_pass http://mybackend; - header_filter_by_lua 'ngx.header.Foo = "blah"'; - } - - -This directive was first introduced in the v0.2.1rc20 release. - -== header_filter_by_lua_block == - -'''syntax:''' ''header_filter_by_lua_block { lua-script }'' - -'''context:''' ''http, server, location, location if'' - -'''phase:''' ''output-header-filter'' - -Similar to the [[#header_filter_by_lua|header_filter_by_lua]] directive except that this directive inlines -the Lua source directly -inside a pair of curly braces ({}) instead of in an NGINX string literal (which requires -special character escaping). - -For instance, - - - header_filter_by_lua_block { - ngx.header["content-length"] = nil - } - - -This directive was first introduced in the v0.9.17 release. - -== header_filter_by_lua_file == - -'''syntax:''' ''header_filter_by_lua_file '' - -'''context:''' ''http, server, location, location if'' - -'''phase:''' ''output-header-filter'' - -Equivalent to [[#header_filter_by_lua|header_filter_by_lua]], except that the file specified by contains the Lua code, or as from the v0.5.0rc32 release, the [[#Lua/LuaJIT bytecode support|Lua/LuaJIT bytecode]] to be executed. - -When a relative path like foo/bar.lua is given, they will be turned into the absolute path relative to the server prefix path determined by the -p PATH command-line option while starting the Nginx server. - -This directive was first introduced in the v0.2.1rc20 release. - -== body_filter_by_lua == - -'''syntax:''' ''body_filter_by_lua '' - -'''context:''' ''http, server, location, location if'' - -'''phase:''' ''output-body-filter'' - -'''NOTE''' Use of this directive is ''discouraged'' following the v0.9.17 release. Use the [[#body_filter_by_lua_block|body_filter_by_lua_block]] directive instead. - -Uses Lua code specified in to define an output body filter. - -The input data chunk is passed via [[#ngx.arg|ngx.arg]][1] (as a Lua string value) and the "eof" flag indicating the end of the response body data stream is passed via [[#ngx.arg|ngx.arg]][2] (as a Lua boolean value). - -Behind the scene, the "eof" flag is just the last_buf (for main requests) or last_in_chain (for subrequests) flag of the Nginx chain link buffers. (Before the v0.7.14 release, the "eof" flag does not work at all in subrequests.) - -The output data stream can be aborted immediately by running the following Lua statement: - - - return ngx.ERROR - - -This will truncate the response body and usually result in incomplete and also invalid responses. - -The Lua code can pass its own modified version of the input data chunk to the downstream Nginx output body filters by overriding [[#ngx.arg|ngx.arg]][1] with a Lua string or a Lua table of strings. For example, to transform all the lowercase letters in the response body, we can just write: - - - location / { - proxy_pass http://mybackend; - body_filter_by_lua 'ngx.arg[1] = string.upper(ngx.arg[1])'; - } - - -When setting nil or an empty Lua string value to ngx.arg[1], no data chunk will be passed to the downstream Nginx output filters at all. - -Likewise, new "eof" flag can also be specified by setting a boolean value to [[#ngx.arg|ngx.arg]][2]. For example, - - - location /t { - echo hello world; - echo hiya globe; - - body_filter_by_lua ' - local chunk = ngx.arg[1] - if string.match(chunk, "hello") then - ngx.arg[2] = true -- new eof - return - end - - -- just throw away any remaining chunk data - ngx.arg[1] = nil - '; - } - - -Then GET /t will just return the output - - - hello world - - -That is, when the body filter sees a chunk containing the word "hello", then it will set the "eof" flag to true immediately, resulting in truncated but still valid responses. - -When the Lua code may change the length of the response body, then it is required to always clear out the Content-Length response header (if any) in a header filter to enforce streaming output, as in - - - location /foo { - # fastcgi_pass/proxy_pass/... - - header_filter_by_lua_block { ngx.header.content_length = nil } - body_filter_by_lua 'ngx.arg[1] = string.len(ngx.arg[1]) .. "\\n"'; - } - - -Note that the following API functions are currently disabled within this context due to the limitations in NGINX output filter's current implementation: - -* Output API functions (e.g., [[#ngx.say|ngx.say]] and [[#ngx.send_headers|ngx.send_headers]]) -* Control API functions (e.g., [[#ngx.exit|ngx.exit]] and [[#ngx.exec|ngx.exec]]) -* Subrequest API functions (e.g., [[#ngx.location.capture|ngx.location.capture]] and [[#ngx.location.capture_multi|ngx.location.capture_multi]]) -* Cosocket API functions (e.g., [[#ngx.socket.tcp|ngx.socket.tcp]] and [[#ngx.req.socket|ngx.req.socket]]). - -Nginx output filters may be called multiple times for a single request because response body may be delivered in chunks. Thus, the Lua code specified by in this directive may also run multiple times in the lifetime of a single HTTP request. - -This directive was first introduced in the v0.5.0rc32 release. - -== body_filter_by_lua_block == - -'''syntax:''' ''body_filter_by_lua_block { lua-script-str }'' - -'''context:''' ''http, server, location, location if'' - -'''phase:''' ''output-body-filter'' - -Similar to the [[#body_filter_by_lua|body_filter_by_lua]] directive except that this directive inlines -the Lua source directly -inside a pair of curly braces ({}) instead of in an NGINX string literal (which requires -special character escaping). - -For instance, - - - body_filter_by_lua_block { - local data, eof = ngx.arg[1], ngx.arg[2] - } - - -This directive was first introduced in the v0.9.17 release. - -== body_filter_by_lua_file == - -'''syntax:''' ''body_filter_by_lua_file '' - -'''context:''' ''http, server, location, location if'' - -'''phase:''' ''output-body-filter'' - -Equivalent to [[#body_filter_by_lua|body_filter_by_lua]], except that the file specified by contains the Lua code, or, as from the v0.5.0rc32 release, the [[#Lua/LuaJIT bytecode support|Lua/LuaJIT bytecode]] to be executed. - -When a relative path like foo/bar.lua is given, they will be turned into the absolute path relative to the server prefix path determined by the -p PATH command-line option while starting the Nginx server. - -This directive was first introduced in the v0.5.0rc32 release. - -== log_by_lua == - -'''syntax:''' ''log_by_lua '' - -'''context:''' ''http, server, location, location if'' - -'''phase:''' ''log'' - -'''NOTE''' Use of this directive is ''discouraged'' following the v0.9.17 release. Use the [[#log_by_lua_block|log_by_lua_block]] directive instead. - -Runs the Lua source code inlined as the at the log request processing phase. This does not replace the current access logs, but runs before. - -Note that the following API functions are currently disabled within this context: - -* Output API functions (e.g., [[#ngx.say|ngx.say]] and [[#ngx.send_headers|ngx.send_headers]]) -* Control API functions (e.g., [[#ngx.exit|ngx.exit]]) -* Subrequest API functions (e.g., [[#ngx.location.capture|ngx.location.capture]] and [[#ngx.location.capture_multi|ngx.location.capture_multi]]) -* Cosocket API functions (e.g., [[#ngx.socket.tcp|ngx.socket.tcp]] and [[#ngx.req.socket|ngx.req.socket]]). - -Here is an example of gathering average data for [[HttpUpstreamModule#$upstream_response_time|$upstream_response_time]]: - - - lua_shared_dict log_dict 5M; - - server { - location / { - proxy_pass http://mybackend; - - log_by_lua ' - local log_dict = ngx.shared.log_dict - local upstream_time = tonumber(ngx.var.upstream_response_time) - - local sum = log_dict:get("upstream_time-sum") or 0 - sum = sum + upstream_time - log_dict:set("upstream_time-sum", sum) - - local newval, err = log_dict:incr("upstream_time-nb", 1) - if not newval and err == "not found" then - log_dict:add("upstream_time-nb", 0) - log_dict:incr("upstream_time-nb", 1) - end - '; - } - - location = /status { - content_by_lua_block { - local log_dict = ngx.shared.log_dict - local sum = log_dict:get("upstream_time-sum") - local nb = log_dict:get("upstream_time-nb") - - if nb and sum then - ngx.say("average upstream response time: ", sum / nb, - " (", nb, " reqs)") - else - ngx.say("no data yet") - end - } - } - } - - -This directive was first introduced in the v0.5.0rc31 release. - -== log_by_lua_block == - -'''syntax:''' ''log_by_lua_block { lua-script }'' - -'''context:''' ''http, server, location, location if'' - -'''phase:''' ''log'' - -Similar to the [[#log_by_lua|log_by_lua]] directive except that this directive inlines -the Lua source directly -inside a pair of curly braces ({}) instead of in an NGINX string literal (which requires -special character escaping). - -For instance, - - - log_by_lua_block { - print("I need no extra escaping here, for example: \r\nblah") - } - - -This directive was first introduced in the v0.9.17 release. - -== log_by_lua_file == - -'''syntax:''' ''log_by_lua_file '' - -'''context:''' ''http, server, location, location if'' - -'''phase:''' ''log'' - -Equivalent to [[#log_by_lua|log_by_lua]], except that the file specified by contains the Lua code, or, as from the v0.5.0rc32 release, the [[#Lua/LuaJIT bytecode support|Lua/LuaJIT bytecode]] to be executed. - -When a relative path like foo/bar.lua is given, they will be turned into the absolute path relative to the server prefix path determined by the -p PATH command-line option while starting the Nginx server. - -This directive was first introduced in the v0.5.0rc31 release. - -== balancer_by_lua_block == - -'''syntax:''' ''balancer_by_lua_block { lua-script }'' - -'''context:''' ''upstream'' - -'''phase:''' ''content'' - -This directive runs Lua code as an upstream balancer for any upstream entities defined -by the upstream {} configuration block. - -For instance, - - - upstream foo { - server 127.0.0.1; - balancer_by_lua_block { - -- use Lua to do something interesting here - -- as a dynamic balancer - } - } - - server { - location / { - proxy_pass http://foo; - } - } - - -The resulting Lua load balancer can work with any existing nginx upstream modules -like [http://nginx.org/en/docs/http/ngx_http_proxy_module.html ngx_proxy] and -[http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html ngx_fastcgi]. - -Also, the Lua load balancer can work with the standard upstream connection pool mechanism, -i.e., the standard [http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive keepalive] directive. -Just ensure that the [http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive keepalive] directive -is used *after* this balancer_by_lua_block directive in a single upstream {} configuration block. - -The Lua load balancer can totally ignore the list of servers defined in the upstream {} block -and select peer from a completely dynamic server list (even changing per request) via the -[https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/balancer.md ngx.balancer] module -from the [https://github.com/openresty/lua-resty-core lua-resty-core] library. - -The Lua code handler registered by this directive might get called more than once in a single -downstream request when the nginx upstream mechanism retries the request on conditions -specified by directives like the [http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream proxy_next_upstream] -directive. - -This Lua code execution context does not support yielding, so Lua APIs that may yield -(like cosockets and "light threads") are disabled in this context. One can usually work -around this limitation by doing such operations in an earlier phase handler (like -[[#access_by_lua|access_by_lua*]]) and passing along the result into this context -via the [[#ngx.ctx|ngx.ctx]] table. - -This directive was first introduced in the v0.10.0 release. - -== balancer_by_lua_file == - -'''syntax:''' ''balancer_by_lua_file '' - -'''context:''' ''upstream'' - -'''phase:''' ''content'' - -Equivalent to [[#balancer_by_lua_block|balancer_by_lua_block]], except that the file specified by contains the Lua code, or, as from the v0.5.0rc32 release, the [[#Lua/LuaJIT bytecode support|Lua/LuaJIT bytecode]] to be executed. - -When a relative path like foo/bar.lua is given, they will be turned into the absolute path relative to the server prefix path determined by the -p PATH command-line option while starting the Nginx server. - -This directive was first introduced in the v0.10.0 release. - -== lua_need_request_body == - -'''syntax:''' ''lua_need_request_body '' - -'''default:''' ''off'' - -'''context:''' ''http, server, location, location if'' - -'''phase:''' ''depends on usage'' - -Determines whether to force the request body data to be read before running rewrite/access/access_by_lua* or not. The Nginx core does not read the client request body by default and if request body data is required, then this directive should be turned on or the [[#ngx.req.read_body|ngx.req.read_body]] function should be called within the Lua code. - -To read the request body data within the [[HttpCoreModule#$request_body|$request_body]] variable, -[[HttpCoreModule#client_body_buffer_size|client_body_buffer_size]] must have the same value as [[HttpCoreModule#client_max_body_size|client_max_body_size]]. Because when the content length exceeds [[HttpCoreModule#client_body_buffer_size|client_body_buffer_size]] but less than [[HttpCoreModule#client_max_body_size|client_max_body_size]], Nginx will buffer the data into a temporary file on the disk, which will lead to empty value in the [[HttpCoreModule#$request_body|$request_body]] variable. - -If the current location includes [[#rewrite_by_lua|rewrite_by_lua*]] directives, -then the request body will be read just before the [[#rewrite_by_lua|rewrite_by_lua*]] code is run (and also at the -rewrite phase). Similarly, if only [[#content_by_lua|content_by_lua]] is specified, -the request body will not be read until the content handler's Lua code is -about to run (i.e., the request body will be read during the content phase). - -It is recommended however, to use the [[#ngx.req.read_body|ngx.req.read_body]] and [[#ngx.req.discard_body|ngx.req.discard_body]] functions for finer control over the request body reading process instead. - -This also applies to [[#access_by_lua|access_by_lua*]]. - -== ssl_certificate_by_lua_block == - -'''syntax:''' ''ssl_certificate_by_lua_block { lua-script }'' - -'''context:''' ''server'' - -'''phase:''' ''right-before-SSL-handshake'' - -This directive runs user Lua code when NGINX is about to start the SSL handshake for the downstream -SSL (https) connections. - -It is particularly useful for setting the SSL certificate chain and the corresponding private key on a per-request -basis. It is also useful to load such handshake configurations nonblockingly from the remote (for example, -with the [[#ngx.socket.tcp|cosocket]] API). And one can also do per-request OCSP stapling handling in pure -Lua here as well. - -Another typical use case is to do SSL handshake traffic control nonblockingly in this context, -with the help of the [https://github.com/openresty/lua-resty-limit-traffic lua-resty-limit-traffic#readme] -library, for example. - -One can also do interesting things with the SSL handshake requests from the client side, like -rejecting old SSL clients using the SSLv3 protocol or even below selectively. - -The [https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl.md ngx.ssl] -and [https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ocsp.md ngx.ocsp] Lua modules -provided by the [https://github.com/openresty/lua-resty-core/#readme lua-resty-core] -library are particularly useful in this context. You can use the Lua API offered by these two Lua modules -to manipulate the SSL certificate chain and private key for the current SSL connection -being initiated. - -This Lua handler does not run at all, however, when NGINX/OpenSSL successfully resumes -the SSL session via SSL session IDs or TLS session tickets for the current SSL connection. In -other words, this Lua handler only runs when NGINX has to initiate a full SSL handshake. - -Below is a trivial example using the -[https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl.md ngx.ssl] module -at the same time: - - - server { - listen 443 ssl; - server_name test.com; - - ssl_certificate_by_lua_block { - print("About to initiate a new SSL handshake!") - } - - location / { - root html; - } - } - - -See more complicated examples in the [https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl.md ngx.ssl] -and [https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ocsp.md ngx.ocsp] -Lua modules' official documentation. - -Uncaught Lua exceptions in the user Lua code immediately abort the current SSL session, so does the -[[#ngx.exit|ngx.exit]] call with an error code like ngx.ERROR. - -This Lua code execution context *does* support yielding, so Lua APIs that may yield -(like cosockets, sleeping, and "light threads") -are enabled in this context. - -Note, however, you still need to configure the [http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate ssl_certificate] and -[http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate_key ssl_certificate_key] -directives even though you will not use this static certificate and private key at all. This is -because the NGINX core requires their appearance otherwise you are seeing the following error -while starting NGINX: - - - nginx: [emerg] no ssl configured for the server - - -This directive currently requires the following NGINX core patch to work correctly: - -http://mailman.nginx.org/pipermail/nginx-devel/2016-January/007748.html - -The bundled version of the NGINX core in OpenResty 1.9.7.2 (or above) already has this -patch applied. - -Furthermore, one needs at least OpenSSL 1.0.2e for this directive to work. - -This directive was first introduced in the v0.10.0 release. - -== ssl_certificate_by_lua_file == - -'''syntax:''' ''ssl_certificate_by_lua_file '' - -'''context:''' ''server'' - -'''phase:''' ''right-before-SSL-handshake'' - -Equivalent to [[#ssl_certificate_by_lua_block|ssl_certificate_by_lua_block]], except that the file specified by contains the Lua code, or, as from the v0.5.0rc32 release, the [[#Lua/LuaJIT bytecode support|Lua/LuaJIT bytecode]] to be executed. - -When a relative path like foo/bar.lua is given, they will be turned into the absolute path relative to the server prefix path determined by the -p PATH command-line option while starting the Nginx server. - -This directive was first introduced in the v0.10.0 release. - -== ssl_session_fetch_by_lua_block == - -'''syntax:''' ''ssl_session_fetch_by_lua_block { lua-script }'' - -'''context:''' ''http'' - -'''phase:''' ''right-before-SSL-handshake'' - -This directive runs Lua code to look up and load the SSL session (if any) according to the session ID -provided by the current SSL handshake request for the downstream. - -The Lua API for obtaining the current session ID and loading a cached SSL session data -is provided in the [ngx.ssl.session](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl/session.md) -Lua module shipped with the [lua-resty-core](https://github.com/openresty/lua-resty-core#readme) -library. - -Lua APIs that may yield, like [[#ngx.sleep|ngx.sleep]] and [[#ngx.socket.tcp|cosockets]], -are enabled in this context. - -This hook, together with the [[#ssl_session_store_by_lua_block|ssl_session_store_by_lua*]] hook, -can be used to implement distributed caching mechanisms in pure Lua (based -on the [[#ngx.socket.tcp|cosocket]] API, for example). If a cached SSL session is found -and loaded into the current SSL connection context, -SSL session resumption can then get immediately initiated and bypass the full SSL handshake process which is very expensive in terms of CPU time. - -Please note that TLS session tickets are very different and it is the clients' responsibility -to cache the SSL session state when session tickets are used. SSL session resumptions based on -TLS session tickets would happen automatically without going through this hook (nor the -[[#ssl_session_store_by_lua*|ssl_session_store_by_lua_block]] hook). This hook is mainly -for older or less capable SSL clients that can only do SSL sessions by session IDs. - -When [[#ssl_certificate_by_lua_block|ssl_certificate_by_lua*]] is specified at the same time, -this hook usually runs before [[#ssl_certificate_by_lua_block|ssl_certificate_by_lua*]]. -When the SSL session is found and successfully loaded for the current SSL connection, -SSL session resumption will happen and thus bypass the [[#ssl_certificate_by_lua_block|ssl_certificate_by_lua*]] -hook completely. In this case, NGINX also bypasses the [[#ssl_session_store_by_lua*|ssl_session_store_by_lua_block]] -hook, for obvious reasons. - -To easily test this hook locally with a modern web browser, you can temporarily put the following line -in your https server block to disable the TLS session ticket support: - - ssl_session_tickets off; - -But do not forget to comment this line out before publishing your site to the world. - -If you are using the [official pre-built packages](http://openresty.org/en/linux-packages.html) for [OpenResty](https://openresty.org/) -1.11.2.1 or later, then everything should work out of the box. - -If you are using OpenSSL libraries not provided by [OpenResty](https://openresty.org), -then you need to apply the following patch for OpenSSL 1.0.2h or later: - -https://github.com/openresty/openresty/blob/master/patches/openssl-1.0.2h-sess_set_get_cb_yield.patch - -If you are not using the NGINX core shipped with [OpenResty](https://openresty.org) 1.11.2.1 or later, then you need to -apply the following patch to the standard NGINX core 1.11.2 or later: - -http://openresty.org/download/nginx-1.11.2-nonblocking_ssl_handshake_hooks.patch - -This directive was first introduced in the v0.10.6 release. - -Note that: this directive is only allowed to used in '''http context''' from the v0.10.7 release -(because SSL session resumption happens before server name dispatch). - -== ssl_session_fetch_by_lua_file == - -'''syntax:''' ''ssl_session_fetch_by_lua_file '' - -'''context:''' ''http'' - -'''phase:''' ''right-before-SSL-handshake'' - -Equivalent to [[#ssl_session_fetch_by_lua_block|ssl_session_fetch_by_lua_block]], except that the file specified by contains the Lua code, or rather, the [[#Lua/LuaJIT bytecode support|Lua/LuaJIT bytecode]] to be executed. - -When a relative path like foo/bar.lua is given, they will be turned into the absolute path relative to the server prefix path determined by the -p PATH command-line option while starting the Nginx server. - -This directive was first introduced in the v0.10.6 release. - -Note that: this directive is only allowed to used in '''http context''' from the v0.10.7 release -(because SSL session resumption happens before server name dispatch). - -== ssl_session_store_by_lua_block == - -'''syntax:''' ''ssl_session_store_by_lua_block { lua-script }'' - -'''context:''' ''http'' - -'''phase:''' ''right-after-SSL-handshake'' - -This directive runs Lua code to fetch and save the SSL session (if any) according to the session ID -provided by the current SSL handshake request for the downstream. The saved or cached SSL -session data can be used for future SSL connections to resume SSL sessions without going -through the full SSL handshake process (which is very expensive in terms of CPU time). - -Lua APIs that may yield, like [[#ngx.sleep|ngx.sleep]] and [[#ngx.socket.tcp|cosockets]], -are *disabled* in this context. You can still, however, use the [[#ngx.timer.at|ngx.timer.at]] API -to create 0-delay timers to save the SSL session data asynchronously to external services (like redis or memcached). - -The Lua API for obtaining the current session ID and the associated session state data -is provided in the [ngx.ssl.session](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl/session.md#readme) -Lua module shipped with the [lua-resty-core](https://github.com/openresty/lua-resty-core#readme) -library. - -To easily test this hook locally with a modern web browser, you can temporarily put the following line -in your https server block to disable the TLS session ticket support: - - ssl_session_tickets off; - -But do not forget to comment this line out before publishing your site to the world. - -This directive was first introduced in the v0.10.6 release. - -Note that: this directive is only allowed to used in '''http context''' from the v0.10.7 release -(because SSL session resumption happens before server name dispatch). - -== ssl_session_store_by_lua_file == - -'''syntax:''' ''ssl_session_store_by_lua_file '' - -'''context:''' ''http'' - -'''phase:''' ''right-after-SSL-handshake'' - -Equivalent to [[#ssl_session_store_by_lua_block|ssl_session_store_by_lua_block]], except that the file specified by contains the Lua code, or rather, the [[#Lua/LuaJIT bytecode support|Lua/LuaJIT bytecode]] to be executed. - -When a relative path like foo/bar.lua is given, they will be turned into the absolute path relative to the server prefix path determined by the -p PATH command-line option while starting the Nginx server. - -This directive was first introduced in the v0.10.6 release. - -Note that: this directive is only allowed to used in '''http context''' from the v0.10.7 release -(because SSL session resumption happens before server name dispatch). - -== lua_shared_dict == - -'''syntax:''' ''lua_shared_dict '' - -'''default:''' ''no'' - -'''context:''' ''http'' - -'''phase:''' ''depends on usage'' - -Declares a shared memory zone, , to serve as storage for the shm based Lua dictionary ngx.shared.. - -Shared memory zones are always shared by all the nginx worker processes in the current nginx server instance. - -The argument accepts size units such as k and m: - - - http { - lua_shared_dict dogs 10m; - ... - } - - -The hard-coded minimum size is 8KB while the practical minimum size depends -on actual user data set (some people start with 12KB). - -See [[#ngx.shared.DICT|ngx.shared.DICT]] for details. - -This directive was first introduced in the v0.3.1rc22 release. - -== lua_socket_connect_timeout == - -'''syntax:''' ''lua_socket_connect_timeout