Merge ~bryce/ubuntu/+source/nginx:merge-v1.22.0-1-kinetic into ubuntu/+source/nginx:debian/sid

Proposed by Bryce Harrington
Status: Merged
Approved by: git-ubuntu bot
Approved revision: not available
Merge reported by: Bryce Harrington
Merged at revision: 85684fad836080922d74619f82ec0a57f6a41229
Proposed branch: ~bryce/ubuntu/+source/nginx:merge-v1.22.0-1-kinetic
Merge into: ubuntu/+source/nginx:debian/sid
Diff against target: 186598 lines (+1665/-76) (has conflicts)
10 files modified
debian/changelog (+1586/-0)
debian/control (+24/-33)
debian/copyright (+0/-5)
debian/modules/control (+0/-8)
debian/patches/series (+9/-0)
debian/patches/ubuntu-branding.patch (+28/-0)
debian/rules (+2/-4)
debian/tests/branding (+12/-0)
debian/tests/control (+4/-8)
dev/null (+0/-18)
Conflict in debian/changelog
Conflict in debian/control
Conflict in debian/patches/series
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Andreas Hasenack (community) Approve
Canonical Server Reporter Pending
Canonical Server Pending
Review via email: mp+427331@code.launchpad.net

Description of the change

Re-merge with Debian's package. This brings in the new 1.22.0 upstream as well as a bunch of packaging work by Debian. The latter mostly involves the lua module which we drop in the Ubuntu delta.

I also took the opportunity to redo the ubuntu-branding patch. The original patch's context includes a #define for the release version, which of course changes every release, and so every time we merge it causes a conflict and requires manual updating.

I modified the ubuntu-branding patch to move our changes down towards the end of the file, away from where the version number is specified. This results in a bit more involved patch since it has to undef and re-def affected things, so not as nicely concise. But now the patch should not require custom modification each time.

Another patch was added to address a FTBFS. I pulled the patch from Debian's unreleased git tree; apparently they are affected as well? The patch originates from upstream, and can drop in the next merge from Debian.

PPA with test packages:
  https://launchpad.net/~bryce/+archive/ubuntu/nginx-merge-v1.22.0-1

    $ sudo add-apt-repository -yus ppa:bryce/nginx-merge-v1.22.0-1
    $ sudo apt-get install nginx

Autopkgtests are still running, check results via:
    $ lp-test-ppa ppa:bryce/nginx-merge-v1.22.0-1 --release kinetic --showpass

Usual tags pushed for review:
  - tags/old/debian 2a59d8d3
  - tags/new/debian 033fa492
  - tags/old/ubuntu 8a1186d4
  - tags/logical/1.20.2-2ubuntu2 0ad0a4a8
  - tags/reconstruct/1.20.2-2ubuntu2 a2e7b4ad
  - tags/split/1.20.2-2ubuntu2 90275922

To post a comment you must log in.
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I think this bug nginx task can be closed, as it builds with pcre3: https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1792544

The upstream bug for that is https://trac.nginx.org/nginx/ticket/720 and it's closed:

"""
PCRE2 support was added in 0b5f12d5c531 (nginx 1.21.5). Thank you for prodding this.
"""

nginx 1.20.2 currently in kinetic already depends on libpcre3, so I'm unsure when it was actually fixed. Maybe the "proper" fix was the patch you dug up.

I also found https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1948699, but we don't have to make a decision here in this upload, it's just a bug I remembered. And there is an even older one about lua in nginx: https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1324062

About the ubuntu branding patch, since the delta is so simple, if it were me I would probably have kept it as is and deal with it in every merge. But I'm not the one experiencing the pain :)
There is a risk, though, of the patch applying, but not being correct. As you said, you are undefining constants and redefining them later. What if upstream decided to change the name of the constants? This patch would still apply, but would then be incorrect. What do you think about this tradeoff?

review: Needs Information
Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks for investigating the situation with lua, and I agree there's discussion to have on enabling it. Since we've shipped as non-lua some time now, probably not urgent, and may be simpler to leave to next merge.

Regarding the branding patch, since the defines in question are version number substitutions throughout the code, it's probably quite unlikely these would change. However, if they did, worst case is the software would continue to compile and run properly, just that any place displaying the version number would display it without "(Ubuntu)", which seems pretty innocuous. I don't think anything specifically *expects* this version string that would break without it. I suppose if we are worried about this, an autopkgtest would be pretty straightforward to check it; probably overkill but I can add it if you think it'd close this hole.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I would feel better with a DEP8 test that checks the server string. A request like this would do it:

$ curl localhost -i -s | grep ^Server
Server: nginx/1.22.0 (Ubuntu)

For fear of hitting the same issue[1] Robie faced when encountering another DEP8 that used version checks, I would suggest to use dpkg -l or dpkg-query -W to get the version of the installed nginx package, instead of parsing something from the source tree.

$ dpkg-query -f='${source:Upstream-Version}\n' -W nginx-core
1.22.0

This should do it:
expected_server_string="Server: nginx/$(dpkg-query -f='${source:Upstream-Version}' -W nginx-core) (Ubuntu)"
actual_server_string=$(curl -i localhost -s | grep ^Server: | sed 's/\r//' )
test "${expected_server_string}" = "${actual_server_string}"

1. https://lists.ubuntu.com/archives/ubuntu-devel/2022-May/042051.html

1e97c38... by Bryce Harrington

  * d/t/branding: Add autopkgtest to validate branding presence

c55fb34... by Bryce Harrington

changelog

Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks, I've added that as a dep8 test and updated the PPA.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Hm, let's use nginx-common as the package, and add some debugging:

autopkgtest [15:58:18]: test branding: [-----------------------
++ dpkg-query '-f=${source:Upstream-Version}' -W nginx-core
+ version=
autopkgtest [15:58:19]: test branding: -----------------------]
autopkgtest [15:58:19]: test branding: - - - - - - - - - - results - - - - - - - - - -
branding FAIL non-zero exit status 139

un nginx-core <none> <none> (no description available)

I suggest this:
#!/bin/bash

set -e

version=$(dpkg-query -f='${source:Upstream-Version}' -W nginx-common)
expected_server_string="Server: nginx/${version} (Ubuntu)"
actual_server_string=$(curl -i localhost -s | grep ^Server: | sed 's/\r//' )

echo "Installed nginx-common version: ${version}"
echo "Server string we got from the live service: ${actual_server_string}"

test "${expected_server_string}" = "${actual_server_string}"

Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks, I've made those updates, updated my branch, and re-run the tests:

stirling: ~$ lp-test-ppa --select-trigger nginx/1.22.0-1ubuntu1~kinetic4 ppa:bryce/nginx-merge-v1.22.0-1 --release kinetic
Tests for PPA nginx-merge-v1.22.0-1
---- ---- ---- ----
Release: kinetic
Sources:
  SRC: nginx @ 1.22.0-1ubuntu1~kinetic4 - Published
  SRC: nginx @ 1.22.0-1ubuntu1~kinetic3 - Superseded
  SRC: nginx @ 1.22.0-1ubuntu1~kinetic2 - Superseded
  SRC: nginx @ 1.22.0-1ubuntu1~kinetic1 - Superseded
Triggers on published Sources:
                 nginx @ amd64 for nginx/1.22.0-1ubuntu1~kinetic4 Trigger @amd64 ♻️ Trigger all proposed @amd64 ♻️ 💍
                 nginx @ s390x for nginx/1.22.0-1ubuntu1~kinetic4 Trigger @s390x ♻️ Trigger all proposed @s390x ♻️ 💍
                 nginx @ ppc64el for nginx/1.22.0-1ubuntu1~kinetic4 Trigger @ppc64el ♻️ Trigger all proposed @ppc64el ♻️ 💍
                 nginx @ arm64 for nginx/1.22.0-1ubuntu1~kinetic4 Trigger @arm64 ♻️ Trigger all proposed @arm64 ♻️ 💍
                 nginx @ armhf for nginx/1.22.0-1ubuntu1~kinetic4 Trigger @armhf ♻️ Trigger all proposed @armhf ♻️ 💍
                 nginx @ riscv64 for nginx/1.22.0-1ubuntu1~kinetic4 Trigger @riscv64 ♻️ Trigger all proposed @riscv64 ♻️ 💍
Results: (from http://autopkgtest.ubuntu.com/results/autopkgtest-kinetic-bryce-nginx-merge-v1.22.0-1/?format=plain)
  nginx @ amd64:
    04.08.22 00:06:25 Log 🗒️ ✅ Triggers: nginx/1.22.0-1ubuntu1~kinetic4
  nginx @ arm64:
    04.08.22 00:32:26 Log 🗒️ ✅ Triggers: nginx/1.22.0-1ubuntu1~kinetic4
  nginx @ armhf:
    04.08.22 00:21:13 Log 🗒️ ✅ Triggers: nginx/1.22.0-1ubuntu1~kinetic4
  nginx @ ppc64el:
    04.08.22 00:07:22 Log 🗒️ ✅ Triggers: nginx/1.22.0-1ubuntu1~kinetic4
  nginx @ s390x:
    04.08.22 00:05:14 Log 🗒️ ✅ Triggers: nginx/1.22.0-1ubuntu1~kinetic4
Running: (none)
Waiting: (none)

Detail from the amd64 test:

autopkgtest [23:48:41]: test branding: [-----------------------
Installed nginx-common version: 1.22.0
Server string we got from the live service: Server: nginx/1.22.0 (Ubuntu)
autopkgtest [23:48:41]: test branding: -----------------------]
autopkgtest [23:48:41]: test branding: - - - - - - - - - - results - - - - - - - - - -
branding PASS

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

shipit!

review: Approve
Revision history for this message
git-ubuntu bot (git-ubuntu-bot) wrote :

Approvers: bryce, ahasenack
Uploaders: bryce, ahasenack
MP auto-approved

review: Approve
Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks, uploaded:

$ grep ^Vcs ../nginx_1.22.0-1ubuntu1_source.changes
Vcs-Git: https://git.launchpad.net/~bryce/ubuntu/+source/nginx
Vcs-Git-Commit: c55fb348e2cc6e69090c0840b1fa5141f49e8ac9
Vcs-Git-Ref: refs/heads/merge-v1.22.0-1-kinetic

$ dput ubuntu ../nginx_1.22.0-1ubuntu1_source.changes
Checking signature on .changes
gpg: ../nginx_1.22.0-1ubuntu1_source.changes: Valid signature from E603B2578FB8F0FB
Checking signature on .dsc
gpg: ../nginx_1.22.0-1ubuntu1.dsc: Valid signature from E603B2578FB8F0FB
Package includes an .orig.tar.gz file although the debian revision suggests
that it might not be required. Multiple uploads of the .orig.tar.gz may be
rejected by the upload queue management software.
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading nginx_1.22.0-1ubuntu1.dsc: done.
  Uploading nginx_1.22.0.orig.tar.gz: done.
  Uploading nginx_1.22.0-1ubuntu1.debian.tar.xz: done.
  Uploading nginx_1.22.0-1ubuntu1_source.buildinfo: done.
  Uploading nginx_1.22.0-1ubuntu1_source.changes: done.
Successfully uploaded packages.

Revision history for this message
Bryce Harrington (bryce) wrote :

One migration issue is that gbrowse fails its tests, however this seems to be known in Debian and unrelated to nginx:

    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1014797

That's reported upstream and suggested to be caused by libgd3:

    https://github.com/GMOD/GBrowse/issues/64

I've filed this update-excuse bug on our end for tracking purposes:

    https://bugs.launchpad.net/gbrowse/+bug/1984454

Upstream seems not active on this codebase for some time, so disabling the test cases may be worth consideration.

304935f... by Bryce Harrington

  * d/control: Drop build-dep on quilt, libgd-dev, and libgeoip-dev
    (in universe)

85684fa... by Bryce Harrington

changelog

Revision history for this message
Bryce Harrington (bryce) wrote :

The other remaining transition issue is some dependency stuff for the new nginx-dev binary. I've filed an MP for that fix:

    https://code.launchpad.net/~bryce/ubuntu/+source/nginx/+git/nginx/+merge/428193

Revision history for this message
Bryce Harrington (bryce) wrote :

 nginx | 1.22.0-1ubuntu1 | kinetic

migrated successfully

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 6bb8afa..e621bf5 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,4 @@
6+<<<<<<< debian/changelog
7 nginx (1.22.0-2) unstable; urgency=medium
8
9 [ Miao Wang ]
10@@ -34,6 +35,69 @@ nginx (1.22.0-2) unstable; urgency=medium
11 + Remove 5 maintscript entries from 1 files.
12
13 -- Jan Mojžíš <jan.mojzis@gmail.com> Sun, 07 Aug 2022 16:14:59 +0200
14+=======
15+nginx (1.22.0-1ubuntu2) kinetic; urgency=medium
16+
17+ * d/control: Drop build-dep on quilt, libgd-dev, and libgeoip-dev
18+ (in universe)
19+
20+ -- Bryce Harrington <bryce@canonical.com> Wed, 10 Aug 2022 19:44:56 -0700
21+
22+nginx (1.22.0-1ubuntu1) kinetic; urgency=medium
23+
24+ * Merge with Debian unstable (LP: #1982626). Remaining changes:
25+ - d/p/ubuntu-branding.patch: add Ubuntu branding
26+ - d/apport/source_nginx.py: Add apport hooks for additional bug
27+ information gathering.
28+ - d/nginx-common.install: Add install rule for apport hooks.
29+ - d/p/nginx-fix-pidfile.patch: Fix NGINX PIDfile handling to avoid
30+ SystemD race condition - thanks to Tj for the patch. (LP #1581864)
31+ - d/control: make nginx and nginx-full arch any, so that nginx-full
32+ is no longer pulled into main because of i386 (LP #1893267)
33+ - Remove the Lua modules from NGINX (Server Team Decision) - future support
34+ for Lua module now requires resty-core from OpenResty, meaning that if
35+ we want to continue to support the Lua module, we have to start becoming
36+ OpenResty - users should just use OpenResty at this point for Lua.
37+ Changes made for this removal:
38+ + d/control:
39+ + Remove lua module from dependencies, and binary build item.
40+ + Add "Breaks" line for nginx-lua for older versions of NGINX.
41+ This is added to the nginx metapackage and nginx-extras.
42+ + d/rules: Remove Lua module from the build flags for -extras.
43+ + d/http-lua, d/modules/{,patches/,watch/}nginx-lua: Remove Lua
44+ modules, watch file, module patches.
45+ + d/modules/control: Remove Lua module from definitions
46+ + d/copyright: Remove lua module.
47+ + d/tests/{control,lua/}: Remove Lua test entirely, remove
48+ dependencies on any test which request
49+ libnginx-mod-http-lua as it's gone.
50+ - d/control: drop GeoIP from nginx-core due to demotion of libgeoip
51+ (LP #1861101, LP #1867150):
52+ + remove libnginx-mod-http-geoip from nginx-core dependency
53+ + have nginx-core depend on libnginx-mod-stream-geoip2
54+ instead of libnginx-mod-stream-geoip
55+ + adjust package descriptions accordingly
56+ - d/control: (GeoIP2 related changes)
57+ + Update dependencies for http-geoip2 package to include libmaxminddb0.
58+ + Update nginx-core to include http-geoip2 module due to approved bin-MIR
59+ (LP #1867198)
60+ + Move geoip2 module build flags to the common flags so all
61+ package flavors have it.
62+ + Update dependencies for nginx-light, etc. to include
63+ libnginx-mod-http-geoip2 as it's in the 'common build flags'
64+ for all flavors of the builds.
65+ + Update package description for nginx-core to indicate geoip2
66+ is included, and to list third party HTTP modules. GeoIP2
67+ is not included for Stream by default, so we have to adjust
68+ this because the Stream part isn't MIR'd.
69+ * d/p/ubuntu-branding.patch: Reimplement patch to avoid conflicting on
70+ (volatile) release version numbers when merging.
71+ * d/m/p/http-subs-filter/pcre2.patch: Patch from debian 0d813834 to
72+ fix FTBFS
73+ * d/t/branding: Add autopkgtest to validate branding presence
74+
75+ -- Bryce Harrington <bryce@canonical.com> Fri, 22 Jul 2022 17:56:50 -0700
76+>>>>>>> debian/changelog
77
78 nginx (1.22.0-1) unstable; urgency=medium
79
80@@ -79,6 +143,82 @@ nginx (1.22.0-1) unstable; urgency=medium
81
82 -- Thomas Ward <teward@ubuntu.com> Tue, 10 May 2022 12:08:02 -0400
83
84+nginx (1.20.2-2ubuntu2) kinetic; urgency=medium
85+
86+ * d/http-lua: Remove another lua patch
87+
88+ -- Bryce Harrington <bryce@canonical.com> Fri, 15 Jul 2022 04:50:47 +0000
89+
90+nginx (1.20.2-2ubuntu1) kinetic; urgency=medium
91+
92+ * Merge with Debian unstable. Remaining changes:
93+ - d/p/ubuntu-branding.patch: add Ubuntu branding
94+ - d/apport/source_nginx.py: Add apport hooks for additional bug
95+ information gathering.
96+ - d/nginx-common.install: Add install rule for apport hooks.
97+ - d/p/nginx-fix-pidfile.patch: Fix NGINX PIDfile handling to avoid
98+ SystemD race condition - thanks to Tj for the patch. (LP #1581864)
99+ - d/control: make nginx and nginx-full arch any, so that nginx-full
100+ is no longer pulled into main because of i386 (LP #1893267)
101+ - Remove the Lua modules from NGINX (Server Team Decision) - future support
102+ for Lua module now requires resty-core from OpenResty, meaning that if
103+ we want to continue to support the Lua module, we have to start becoming
104+ OpenResty - users should just use OpenResty at this point for Lua.
105+ Changes made for this removal:
106+ + d/control:
107+ + Remove lua module from dependencies, and binary build item.
108+ + Add "Breaks" line for nginx-lua for older versions of NGINX.
109+ This is added to the nginx metapackage and nginx-extras.
110+ + d/rules: Remove Lua module from the build flags for -extras.
111+ + d/modules/{,patches/,watch/}nginx-lua: Remove Lua module, watch file,
112+ module patches.
113+ + d/modules/control: Remove Lua module from definitions
114+ + d/copyright: Remove lua module.
115+ + d/tests/{control,lua/}: Remove Lua test entirely, remove
116+ dependencies on any test which request
117+ libnginx-mod-http-lua as it's gone.
118+ - d/control: drop GeoIP from nginx-core due to demotion of libgeoip
119+ (LP #1861101, LP #1867150):
120+ + remove libnginx-mod-http-geoip from nginx-core dependency
121+ + have nginx-core depend on libnginx-mod-stream-geoip2
122+ instead of libnginx-mod-stream-geoip
123+ + adjust package descriptions accordingly
124+ - d/control: (GeoIP2 related changes)
125+ + Update dependencies for http-geoip2 package to include libmaxminddb0.
126+ + Update nginx-core to include http-geoip2 module due to approved bin-MIR
127+ (LP #1867198)
128+ + Move geoip2 module build flags to the common flags so all
129+ package flavors have it.
130+ + Update dependencies for nginx-light, etc. to include
131+ libnginx-mod-http-geoip2 as it's in the 'common build flags'
132+ for all flavors of the builds.
133+ + Update package description for nginx-core to indicate geoip2
134+ is included, and to list third party HTTP modules. GeoIP2
135+ is not included for Stream by default, so we have to adjust
136+ this because the Stream part isn't MIR'd.
137+ * d/p/ubuntu-branding.patch: Refresh
138+ * Dropped:
139+ - DNS Resolver Off-by-One Heap Write
140+ + debian/patches/CVE-2021-23017.patch: fix logic in
141+ src/core/ngx_resolver.c.
142+ [Not needed: Replaced by upstream patches in separate commit]
143+ - DNS Resolver issues
144+ + debian/patches/CVE-2021-23017-1.patch: fixed off-by-one write in
145+ src/core/ngx_resolver.c.
146+ + debian/patches/CVE-2021-23017-2.patch: fixed off-by-one read in
147+ src/core/ngx_resolver.c.
148+ + debian/patches/CVE-2021-23017.patch: removed, replaced with upstream
149+ commits.
150+ [Included in upstream release 1.20.1]
151+ - ALPACA TLS issue
152+ + debian/patches/CVE-2021-3618.patch: specify the number of
153+ errors after which the connection is closed in
154+ src/mail/ngx_mail.h, src/mail/ngx_mail_core_module.c and
155+ src/mail/ngx_mail_handler.c.
156+ [Included in Debian release 1.20.2-2]
157+
158+ -- Bryce Harrington <bryce@canonical.com> Tue, 12 Jul 2022 10:23:53 -0700
159+
160 nginx (1.20.2-2) unstable; urgency=medium
161
162 [ Thomas Ward ]
163@@ -171,6 +311,156 @@ nginx (1.18.0-6.1) unstable; urgency=high
164
165 -- Salvatore Bonaccorso <carnil@debian.org> Sat, 29 May 2021 16:21:37 +0200
166
167+nginx (1.18.0-6ubuntu14.1) jammy-security; urgency=medium
168+
169+ * SECURITY UPDATE: ALPACA TLS issue
170+ - debian/patches/CVE-2021-3618.patch: specify the number of
171+ errors after which the connection is closed in
172+ src/mail/ngx_mail.h, src/mail/ngx_mail_core_module.c and
173+ src/mail/ngx_mail_handler.c.
174+ - CVE-2021-3618
175+
176+ -- David Fernandez Gonzalez <david.fernandezgonzalez@canonical.com> Wed, 27 Apr 2022 12:56:57 +0200
177+
178+nginx (1.18.0-6ubuntu14) jammy; urgency=medium
179+
180+ * No-change rebuild to update maintainer scripts, see LP: 1959054
181+
182+ -- Dave Jones <dave.jones@canonical.com> Wed, 16 Feb 2022 17:10:20 +0000
183+
184+nginx (1.18.0-6ubuntu13) jammy; urgency=medium
185+
186+ * No-change rebuild for the perl update.
187+
188+ -- Matthias Klose <doko@ubuntu.com> Sun, 06 Feb 2022 13:48:12 +0100
189+
190+nginx (1.18.0-6ubuntu12) jammy; urgency=medium
191+
192+ * No-change rebuild against openssl3
193+
194+ -- Simon Chopin <simon.chopin@canonical.com> Wed, 24 Nov 2021 13:59:50 +0000
195+
196+nginx (1.18.0-6ubuntu11) impish; urgency=medium
197+
198+ * No-change rebuild to build packages with zstd compression.
199+
200+ -- Matthias Klose <doko@ubuntu.com> Thu, 07 Oct 2021 12:21:36 +0200
201+
202+nginx (1.18.0-6ubuntu10) impish; urgency=medium
203+
204+ * SECURITY UPDATE: DNS Resolver issues
205+ - debian/patches/CVE-2021-23017-1.patch: fixed off-by-one write in
206+ src/core/ngx_resolver.c.
207+ - debian/patches/CVE-2021-23017-2.patch: fixed off-by-one read in
208+ src/core/ngx_resolver.c.
209+ - debian/patches/CVE-2021-23017.patch: removed, replaced with upstream
210+ commits.
211+ - CVE-2021-23017
212+
213+ -- Marc Deslauriers <marc.deslauriers@ubuntu.com> Wed, 26 May 2021 06:59:42 -0400
214+
215+nginx (1.18.0-6ubuntu9) impish; urgency=medium
216+
217+ * SECURITY UPDATE: DNS Resolver Off-by-One Heap Write
218+ - debian/patches/CVE-2021-23017.patch: fix logic in
219+ src/core/ngx_resolver.c.
220+ - CVE-2021-23017
221+
222+ -- Marc Deslauriers <marc.deslauriers@ubuntu.com> Tue, 25 May 2021 13:06:54 -0400
223+
224+nginx (1.18.0-6ubuntu8) hirsute; urgency=medium
225+
226+ * d/modules/control: Remove Lua module from definitions
227+ * d/tests/:
228+ - control: Remove Lua test, remove dependencies on any test which
229+ request libnginx-mod-http-lua as it's gone.
230+ - lua: Remove the lua test entirely.
231+
232+ -- Thomas Ward <teward@ubuntu.com> Wed, 10 Mar 2021 10:50:43 -0500
233+
234+nginx (1.18.0-6ubuntu7) hirsute; urgency=medium
235+
236+ * d/control:
237+ - Fix dependencies issue for libnginx-mod-http-geoip2 - missing a
238+ character in the depends.
239+
240+ -- Thomas Ward <teward@ubuntu.com> Tue, 09 Mar 2021 19:03:55 -0500
241+
242+nginx (1.18.0-6ubuntu6) hirsute; urgency=medium
243+
244+ * d/control:
245+ - Update dependencies for nginx-light, etc. to include
246+ libnginx-mod-http-geoip2 as it's in the 'common build flags' for
247+ all flavors of the builds.
248+ - Update nginx-core package description to list third party HTTP
249+ modules. GeoIP2 is not included for Stream by default, so we
250+ have to adjust this because the Stream part isn't MIR'd.
251+
252+ -- Thomas Ward <teward@ubuntu.com> Tue, 09 Mar 2021 12:41:36 -0500
253+
254+nginx (1.18.0-6ubuntu5) hirsute; urgency=medium
255+
256+ * d/control: (GeoIP2 related changes)
257+ - Update dependencies for http-geoip2 package.
258+ - Update nginx-core to include http-geoip2 module due to approved bin-MIR
259+ (LP: #1867198)
260+ - Update description to nginx-core to indicate geoip2 is included.
261+ * d/control: move geoip2 module build flags to the common flags so all
262+ package flavors have it.
263+ * d/modules/http-geoip2: Update to upstream version 3.3.
264+ * Remove the Lua modules from NGINX (Server Team Decision) - future support
265+ for Lua module now requires resty-core from OpenResty, meaning that if
266+ we want to continue to support the Lua module, we have to start becoming
267+ OpenResty - users should just use OpenResty at this point for Lua.
268+ Changes made for this removal:
269+ - d/control:
270+ - Remove lua module from dependencies, and binary build item.
271+ - Add "Breaks" line for nginx-lua for older versions of NGINX.
272+ This is added to the nginx metapackage and nginx-extras.
273+ - d/copyright: Remove lua module.
274+ - d/modules/{,patches/,watch/}nginx-lua: Remove Lua module, watch file,
275+ module patches.
276+ - d/rules: Remove Lua module from the build flags for -extras.
277+
278+ -- Thomas Ward <teward@ubuntu.com> Mon, 08 Mar 2021 09:59:56 -0500
279+
280+nginx (1.18.0-6ubuntu4) hirsute; urgency=medium
281+
282+ * No-change rebuild for the perl update.
283+
284+ -- Matthias Klose <doko@ubuntu.com> Mon, 09 Nov 2020 12:46:47 +0100
285+
286+nginx (1.18.0-6ubuntu3) hirsute; urgency=medium
287+
288+ * No-change rebuild for the perl update.
289+
290+ -- Matthias Klose <doko@ubuntu.com> Mon, 09 Nov 2020 10:51:27 +0100
291+
292+nginx (1.18.0-6ubuntu2) groovy; urgency=medium
293+
294+ * d/control: make nginx and nginx-full arch any, so that nginx-full
295+ is no longer pulled into main because of i386 (LP: #1893267)
296+
297+ -- Andreas Hasenack <andreas@canonical.com> Thu, 27 Aug 2020 16:59:57 -0300
298+
299+nginx (1.18.0-6ubuntu1) groovy; urgency=medium
300+
301+ * Merge with Debian unstable. Remaining changes:
302+ - d/p/ubuntu-branding.patch: add Ubuntu branding
303+ - d/apport/source_nginx.py: Add apport hooks for additional bug
304+ information gathering.
305+ - d/nginx-common.install: Add install rule for apport hooks.
306+ - d/p/nginx-fix-pidfile.patch: Fix NGINX PIDfile handling to avoid
307+ SystemD race condition - thanks to Tj for the patch. (LP #1581864)
308+ - d/control: drop GeoIP from nginx-core due to demotion of libgeoip
309+ (LP #1861101, LP #1867150):
310+ + remove libnginx-mod-http-geoip from nginx-core dependency
311+ + have nginx-core depend on libnginx-mod-stream-geoip2
312+ instead of libnginx-mod-stream-geoip
313+ + adjust package descriptions accordingly
314+
315+ -- Andreas Hasenack <andreas@canonical.com> Tue, 25 Aug 2020 11:11:41 -0300
316+
317 nginx (1.18.0-6) unstable; urgency=medium
318
319 * Fix GCC-10 compatibility (Closes: #957605).
320@@ -195,6 +485,69 @@ nginx (1.18.0-4) unstable; urgency=medium
321
322 -- Ondřej Nový <onovy@debian.org> Fri, 03 Jul 2020 09:34:49 +0200
323
324+nginx (1.18.0-3ubuntu2) groovy; urgency=medium
325+
326+ * Re-apply demotion of geoip in favor of geoip2
327+ - Fixes some accidentally dropped delta from merge to fix
328+ unsatisfiable depends. nginx-[core|full] need to depend on
329+ libnginx-mod-stream-geoip2, not on -geoip.
330+ (LP #1861101)
331+
332+ -- Bryce Harrington <bryce@canonical.com> Mon, 06 Jul 2020 15:12:26 -0700
333+
334+nginx (1.18.0-3ubuntu1) groovy; urgency=medium
335+
336+ * Merge with Debian unstable. Remaining changes:
337+ - d/p/ubuntu-branding.patch: add Ubuntu branding (refreshed)
338+ - d/apport/source_nginx.py: Add apport hooks for additional bug
339+ information gathering.
340+ - d/nginx-common.install: Add install rule for apport hooks.
341+ - d/p/nginx-fix-pidfile.patch: Fix NGINX PIDfile handling to avoid
342+ SystemD race condition - thanks to Tj for the patch. (LP #1581864)
343+ - Drop GeoIP from nginx-core due to demotion of libgeoip
344+ (LP #1861101, LP #1867150):
345+ + d/control: Remove libnginx-mod-http-geoip from nginx-core dependency
346+ + d/rules: Remove the configure line of with-http_geoip_module=dynamic
347+ from the nginx-core build flags, due to demotion of libgeoip and the
348+ removal of the dynamic library from install deps for nginx-core.
349+ * d/a/source_nginx.py: Fix indentation in apport hook
350+ * d/p/nginx-fix-pidfile.patch: Update dep3 with fwd debian link
351+ * Dropped:
352+ - debian/patches/0002-Make-sure-signature-stays-the-same-in-
353+ all-nginx-buil.patch: Refreshed patch - Merge-o-Matic introduced some
354+ fuzz which caused issues.
355+ [ Does not seem necessary ]
356+ - d/control: drop mention of SSL Preread from nginx-full, nginx-extras
357+ [ Previously undocumented ]
358+ - d/gbp.conf: update for 1.12 release
359+ [ Previously undocumented ]
360+ - d/p/0003-define_gnu_source-on-other-glibc-based-platforms.patch:
361+ Refresh patch.
362+ [ Previously undocumented ]
363+ - d/{control,rules,nginx-core.*}: add new binary package for main,
364+ nginx-core, which contains only source-tarball-included modules
365+ and no third-party modules.
366+ - debian/tests/control: add nginx-core test.
367+ - Add GeoIP2 third party module to nginx-full and nginx-extras
368+ (LP #1825895). The following is the files list for this:
369+ + d/{control,rules}: Add libnginx-mod-http-geoip2 and corresponding
370+ build rules.
371+ + d/modules/http-geoip2{,/*}: Add geoip2 module from third party git.
372+ + d/copyright: Add relevant copyright lines for GeoIP2 module.
373+ - d/conf/sites-available/default: Update PHP path for PHP 7.4.
374+ [added in 1.17.9-0ubuntu3 taken by Debian in 1.18.0-2]
375+ - d/nginx-full.postinst: Add checks for whether
376+ port 80 is in use or not to determine whether or not to attempt
377+ starting of the NGINX service during install/upgrade.
378+ - d/control: Add dependency from nginx-full on `iproute2` as the
379+ postinst scripts now use `ss` to determine if Port 80 is open
380+ or not.
381+ [Taken by Debian in 1.18.0-2]
382+ - d/rules: Enable --with-compat build option for all nginx package
383+ flavors (LP #1797897)
384+
385+ -- Bryce Harrington <bryce@canonical.com> Wed, 24 Jun 2020 23:15:11 +0000
386+
387 nginx (1.18.0-3) unstable; urgency=medium
388
389 * Source-only upload to allow migration.
390@@ -252,6 +605,225 @@ nginx (1.18.0-1) unstable; urgency=medium
391
392 -- Ondřej Nový <onovy@debian.org> Fri, 29 May 2020 19:03:30 +0200
393
394+nginx (1.17.10-0ubuntu1) focal; urgency=medium
395+
396+ * New upstream release (1.17.9) - full changelog available from
397+ http://nginx.org/en/CHANGES
398+ * Remaining Ubuntu-specific changes:
399+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
400+ - d/{control,rules,nginx-core.*}: add new binary package for main,
401+ nginx-core, which contains only source-tarball-included modules
402+ and no third-party modules.
403+ - debian/tests/control: add nginx-core test.
404+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
405+ information gathering.
406+ - debian/nginx-common.install: Add install rule for apport hooks.
407+ - d/nginx-{core,light,full,extras}.postinst: Add checks for whether
408+ port 80 is in use or not to determine whether or not to attempt
409+ starting of the NGINX service during install/upgrade
410+ - d/control: Add dependencies to nginx-{core,light,full,extras} on
411+ `iproute2` as the postinst scripts now use `ss` to determine if
412+ Port 80 is open or not.
413+ - d/rules: Enable --with-compat build option for all nginx package
414+ flavors
415+ - d/{control,rules,copyright,modules/http-geoip2*}: Add GeoIP2 third party
416+ module to nginx-full and nginx-extras (and use proper DEP5 syntax for
417+ d/copyright).
418+ - d/control, d/rules: Drop GeoIP from nginx-core due to demotion of
419+ libgeoip.
420+
421+ -- Thomas Ward <teward@ubuntu.com> Tue, 14 Apr 2020 12:53:34 -0400
422+
423+nginx (1.17.9-0ubuntu3) focal; urgency=medium
424+
425+ * d/conf/sites-available/default: Update PHP path for PHP 7.4.
426+
427+ -- Thomas Ward <teward@ubuntu.com> Thu, 26 Mar 2020 10:53:52 -0400
428+
429+nginx (1.17.9-0ubuntu2) focal; urgency=medium
430+
431+ * Drop GeoIP from nginx-core due to demotion of libgeoip (LP: #1861101,
432+ LP: #1867150):
433+ - d/control: Remove libnginx-mod-http-geoip from nginx-core dependency
434+ - d/rules: Remove the configure line of with-http_geoip_module=dynamic
435+ from the nginx-core build flags, due to demotion of libgeoip and the
436+ removal of the dynamic library from install deps for nginx-core.
437+
438+ -- Thomas Ward <teward@ubuntu.com> Wed, 11 Mar 2020 13:41:07 -0400
439+
440+nginx (1.17.9-0ubuntu1) focal; urgency=medium
441+
442+ * New upstream release (1.17.9) - full changelog available from
443+ http://nginx.org/en/CHANGES
444+ * Remaining Ubuntu-specific changes:
445+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
446+ - d/{control,rules,nginx-core.*}: add new binary package for main,
447+ nginx-core, which contains only source-tarball-included modules
448+ and no third-party modules.
449+ - debian/tests/control: add nginx-core test.
450+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
451+ information gathering.
452+ - debian/nginx-common.install: Add install rule for apport hooks.
453+ - d/nginx-{core,light,full,extras}.postinst: Add checks for whether
454+ port 80 is in use or not to determine whether or not to attempt
455+ starting of the NGINX service during install/upgrade
456+ - d/control: Add dependencies to nginx-{core,light,full,extras} on
457+ `iproute2` as the postinst scripts now use `ss` to determine if
458+ Port 80 is open or not.
459+ - d/rules: Enable --with-compat build option for all nginx package
460+ flavors
461+ - d/{control,rules,copyright,modules/http-geoip2*}: Add GeoIP2 third party
462+ module to nginx-full and nginx-extras (and use proper DEP5 syntax for
463+ d/copyright).
464+
465+ -- Thomas Ward <teward@ubuntu.com> Tue, 03 Mar 2020 11:05:45 -0500
466+
467+nginx (1.17.8-0ubuntu3) focal; urgency=medium
468+
469+ * d/conf/sites-available/default: Indentation consistency.
470+ Fix an indentation issue introduced by 1.17.8-0ubuntu2 to make sure that
471+ indentation in the default config file is consistent.
472+
473+ -- Thomas Ward <teward@ubuntu.com> Wed, 26 Feb 2020 10:35:13 -0500
474+
475+nginx (1.17.8-0ubuntu2) focal; urgency=medium
476+
477+ * d/conf/sites-available/default: Revert changes done in #1743592.
478+ Reverts this change:
479+ - d/conf/sites-available/default: Update default nginx site
480+ configuration file to remove the IPv6 listening line so that servers
481+ running without IPv6 enabled at all on the system will start nginx
482+ properly.
483+
484+ -- Thomas Ward <teward@ubuntu.com> Thu, 20 Feb 2020 13:52:32 -0500
485+
486+nginx (1.17.8-0ubuntu1) focal; urgency=medium
487+
488+ * New upstream release (1.17.8) - full changelog available from
489+ http://nginx.org/en/CHANGES
490+ * Remaining Ubuntu-specific changes:
491+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
492+ - d/{control,rules,nginx-core.*}: add new binary package for main,
493+ nginx-core, which contains only source-tarball-included modules
494+ and no third-party modules.
495+ - debian/tests/control: add nginx-core test.
496+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
497+ information gathering.
498+ - debian/nginx-common.install: Add install rule for apport hooks.
499+ - d/nginx-{core,light,full,extras}.postinst: Add checks for whether
500+ port 80 is in use or not to determine whether or not to attempt
501+ starting of the NGINX service during install/upgrade
502+ - d/control: Add dependencies to nginx-{core,light,full,extras} on
503+ `iproute2` as the postinst scripts now use `ss` to determine if
504+ Port 80 is open or not.
505+ - d/rules: Enable --with-compat build option for all nginx package
506+ flavors
507+ - d/{control,rules,copyright,modules/http-geoip2*}: Add GeoIP2 third party
508+ module to nginx-full and nginx-extras (and use proper DEP5 syntax for
509+ d/copyright).
510+ - d/conf/sites-available/default: Update default nginx site configuration
511+ file to remove the IPv6 listening line so that servers running without
512+ IPv6 enabled at all on the system will start nginx properly.
513+ (LP: #1743592)
514+
515+ -- Thomas Ward <teward@ubuntu.com> Tue, 18 Feb 2020 19:01:02 -0500
516+
517+nginx (1.17.7-0ubuntu1) focal; urgency=medium
518+
519+ * New upstream release (1.17.7) - full changelog available from
520+ http://nginx.org/en/CHANGES
521+ * Remaining Ubuntu-specific changes:
522+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
523+ - d/{control,rules,nginx-core.*}: add new binary package for main,
524+ nginx-core, which contains only source-tarball-included modules
525+ and no third-party modules.
526+ - debian/tests/control: add nginx-core test.
527+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
528+ information gathering.
529+ - debian/nginx-common.install: Add install rule for apport hooks.
530+ - d/nginx-{core,light,full,extras}.postinst: Add checks for whether
531+ port 80 is in use or not to determine whether or not to attempt
532+ starting of the NGINX service during install/upgrade
533+ - d/control: Add dependencies to nginx-{core,light,full,extras} on
534+ `iproute2` as the postinst scripts now use `ss` to determine if
535+ Port 80 is open or not.
536+ - d/rules: Enable --with-compat build option for all nginx package
537+ flavors
538+ - d/{control,rules,copyright,modules/http-geoip2*}: Add GeoIP2 third party
539+ module to nginx-full and nginx-extras (and use proper DEP5 syntax for
540+ d/copyright).
541+ - d/conf/sites-available/default: Update default nginx site configuration
542+ file to remove the IPv6 listening line so that servers running without
543+ IPv6 enabled at all on the system will start nginx properly.
544+ (LP: #1743592)
545+
546+
547+ -- Thomas Ward <teward@ubuntu.com> Mon, 30 Dec 2019 13:02:58 -0500
548+
549+nginx (1.17.6-0ubuntu1) focal; urgency=medium
550+
551+ * New upstream release (1.17.6) - full changelog available from
552+ http://nginx.org/en/CHANGES
553+ * Remaining Ubuntu-specific changes:
554+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
555+ - d/{control,rules,nginx-core.*}: add new binary package for main,
556+ nginx-core, which contains only source-tarball-included modules
557+ and no third-party modules.
558+ - debian/tests/control: add nginx-core test.
559+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
560+ information gathering.
561+ - debian/nginx-common.install: Add install rule for apport hooks.
562+ - d/nginx-{core,light,full,extras}.postinst: Add checks for whether
563+ port 80 is in use or not to determine whether or not to attempt
564+ starting of the NGINX service during install/upgrade
565+ - d/control: Add dependencies to nginx-{core,light,full,extras} on
566+ `iproute2` as the postinst scripts now use `ss` to determine if
567+ Port 80 is open or not.
568+ - d/rules: Enable --with-compat build option for all nginx package
569+ flavors
570+ - d/{control,rules,copyright,modules/http-geoip2*}: Add GeoIP2 third party
571+ module to nginx-full and nginx-extras (and use proper DEP5 syntax for
572+ d/copyright).
573+ - d/conf/sites-available/default: Update default nginx site configuration
574+ file to remove the IPv6 listening line so that servers running without
575+ IPv6 enabled at all on the system will start nginx properly.
576+ (LP: #1743592)
577+
578+
579+ -- Thomas Ward <teward@ubuntu.com> Tue, 19 Nov 2019 10:34:14 -0500
580+
581+nginx (1.17.5-0ubuntu1) focal; urgency=medium
582+
583+ * New upstream release (1.17.5) - full changelog available from
584+ http://nginx.org/en/CHANGES
585+ * Remaining Ubuntu-specific changes:
586+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
587+ - d/{control,rules,nginx-core.*}: add new binary package for main,
588+ nginx-core, which contains only source-tarball-included modules
589+ and no third-party modules.
590+ - debian/tests/control: add nginx-core test.
591+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
592+ information gathering.
593+ - debian/nginx-common.install: Add install rule for apport hooks.
594+ - d/nginx-{core,light,full,extras}.postinst: Add checks for whether
595+ port 80 is in use or not to determine whether or not to attempt
596+ starting of the NGINX service during install/upgrade
597+ - d/control: Add dependencies to nginx-{core,light,full,extras} on
598+ `iproute2` as the postinst scripts now use `ss` to determine if
599+ Port 80 is open or not.
600+ - d/rules: Enable --with-compat build option for all nginx package
601+ flavors
602+ - d/{control,rules,copyright,modules/http-geoip2*}: Add GeoIP2 third party
603+ module to nginx-full and nginx-extras (and use proper DEP5 syntax for
604+ d/copyright).
605+ * New Ubuntu-specific changes:
606+ - d/conf/sites-available/default: Update default nginx site configuration
607+ file to remove the IPv6 listening line so that servers running without
608+ IPv6 enabled at all on the system will start nginx properly.
609+ (LP: #1743592)
610+
611+ -- Thomas Ward <teward@ubuntu.com> Fri, 01 Nov 2019 11:55:10 -0400
612+
613 nginx (1.16.1-3) unstable; urgency=high
614
615 * Handle CVE-2019-20372, error page request smuggling
616@@ -276,6 +848,294 @@ nginx (1.16.1-1) unstable; urgency=medium
617
618 -- Christos Trochalakis <ctrochalakis@debian.org> Mon, 09 Sep 2019 18:24:43 +0300
619
620+nginx (1.16.1-0ubuntu3) focal; urgency=medium
621+
622+ * No-change rebuild for the perl update.
623+
624+ -- Matthias Klose <doko@ubuntu.com> Fri, 18 Oct 2019 19:37:10 +0000
625+
626+nginx (1.16.1-0ubuntu2) eoan; urgency=medium
627+
628+ * d/conf/sites-available/default: Update PHP referred to in the
629+ example in the default configuration to PHP 7.2.
630+ (LP: #1831748)
631+
632+ -- Thomas Ward <teward@ubuntu.com> Thu, 15 Aug 2019 12:01:39 -0400
633+
634+nginx (1.16.1-0ubuntu1) eoan; urgency=medium
635+
636+ * New upstream release (1.16.1) - full changelog available from
637+ http://nginx.org/en/CHANGES-1.16
638+ * This patch contains security patches only.
639+ * Security content in this version:
640+ - When using HTTP/2 a client might cause excessive memory consumption
641+ and CPU usage (CVE-2019-9511. CVE-2019-9513, CVE-2019-9516)
642+
643+ -- Thomas Ward <teward@ubuntu.com> Tue, 13 Aug 2019 13:08:03 -0400
644+
645+nginx (1.16.0-0ubuntu2) eoan; urgency=medium
646+
647+ * d/patches/nginx-fix-pidfile.patch: Fix NGINX PIDfile handling to avoid
648+ SystemD race condition - thanks to Tj for the patch. (LP: #1581864)
649+
650+ -- Thomas Ward <teward@ubuntu.com> Tue, 04 Jun 2019 11:43:30 -0400
651+
652+nginx (1.16.0-0ubuntu1) eoan; urgency=medium
653+
654+ * New upstream release (1.16.0) - full changelog available from
655+ http://nginx.org/en/CHANGES
656+ * Remaining Ubuntu-specific changes:
657+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
658+ - d/{control,rules,nginx-core.*}: add new binary package for main,
659+ nginx-core, which contains only source-tarball-included modules
660+ and no third-party modules.
661+ - debian/tests/control: add nginx-core test.
662+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
663+ information gathering.
664+ - debian/nginx-common.install: Add install rule for apport hooks.
665+ - d/nginx-{core,light,full,extras}.postinst: Add checks for whether
666+ port 80 is in use or not to determine whether or not to attempt
667+ starting of the NGINX service during install/upgrade
668+ - d/control: Add dependencies to nginx-{core,light,full,extras} on
669+ `iproute2` as the postinst scripts now use `ss` to determine if
670+ Port 80 is open or not.
671+ - d/rules: Enable --with-compat build option for all nginx package
672+ flavors
673+ - d/{control,rules,copyright,modules/http-geoip2*}: Add GeoIP2 third party
674+ module to nginx-full and nginx-extras
675+
676+ -- Thomas Ward <teward@ubuntu.com> Mon, 29 Apr 2019 12:31:39 -0400
677+
678+nginx (1.15.12-0ubuntu1) eoan; urgency=medium
679+
680+ * New upstream release (1.15.12) - full changelog available from
681+ http://nginx.org/en/CHANGES
682+ * Remaining Ubuntu-specific changes:
683+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
684+ - d/{control,rules,nginx-core.*}: add new binary package for main,
685+ nginx-core, which contains only source-tarball-included modules
686+ and no third-party modules.
687+ - debian/tests/control: add nginx-core test.
688+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
689+ information gathering.
690+ - debian/nginx-common.install: Add install rule for apport hooks.
691+ - d/nginx-{core,light,full,extras}.postinst: Add checks for whether
692+ port 80 is in use or not to determine whether or not to attempt
693+ starting of the NGINX service during install/upgrade
694+ - d/control: Add dependencies to nginx-{core,light,full,extras} on
695+ `iproute2` as the postinst scripts now use `ss` to determine if
696+ Port 80 is open or not.
697+ - d/rules: Enable --with-compat build option for all nginx package
698+ flavors
699+ * Add GeoIP2 third party module to nginx-full and nginx-extras
700+ (LP: #1825895). The following is the files list for this:
701+ - d/{control,rules}: Add libnginx-mod-http-geoip2 and corresponding build
702+ rules.
703+ - d/modules/http-geoip2{,/*}: Add geoip2 module from third party git.
704+ - d/copyright: Add relevant copyright lines for GeoIP2 module.
705+
706+ -- Thomas Ward <teward@ubuntu.com> Mon, 22 Apr 2019 17:59:46 -0400
707+
708+nginx (1.15.8-0ubuntu1) disco; urgency=medium
709+
710+ * New upstream release (1.15.8) - full changelog available from
711+ http://nginx.org/en/CHANGES
712+ * Remaining Ubuntu-specific changes:
713+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
714+ - d/{control,rules,nginx-core.*}: add new binary package for main,
715+ nginx-core, which contains only source-tarball-included modules
716+ and no third-party modules.
717+ - debian/tests/control: add nginx-core test.
718+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
719+ information gathering.
720+ - debian/nginx-common.install: Add install rule for apport hooks.
721+ - d/nginx-{core,light,full,extras}.postinst: Add checks for whether
722+ port 80 is in use or not to determine whether or not to attempt
723+ starting of the NGINX service during install/upgrade
724+ - d/control: Add dependencies to nginx-{core,light,full,extras} on
725+ `iproute2` as the postinst scripts now use `ss` to determine if
726+ Port 80 is open or not.
727+ - d/rules: Enable --with-compat build option for all nginx package
728+ flavors
729+
730+ -- Thomas Ward <teward@ubuntu.com> Fri, 01 Feb 2019 20:21:45 -0500
731+
732+nginx (1.15.7-0ubuntu1) disco; urgency=medium
733+
734+ * New upstream release (1.15.7) - full changelog available from
735+ http://nginx.org/en/CHANGES
736+ * Remaining Ubuntu-specific changes:
737+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
738+ - d/{control,rules,nginx-core.*}: add new binary package for main,
739+ nginx-core, which contains only source-tarball-included modules
740+ and no third-party modules.
741+ - debian/tests/control: add nginx-core test.
742+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
743+ information gathering.
744+ - debian/nginx-common.install: Add install rule for apport hooks.
745+ - d/nginx-{core,light,full,extras}.postinst: Add checks for whether
746+ port 80 is in use or not to determine whether or not to attempt
747+ starting of the NGINX service during install/upgrade
748+ - d/control: Add dependencies to nginx-{core,light,full,extras} on
749+ `iproute2` as the postinst scripts now use `ss` to determine if
750+ Port 80 is open or not.
751+ - d/rules: Enable --with-compat build option for all nginx package
752+ flavors (LP: #1797897)
753+
754+ -- Thomas Ward <teward@ubuntu.com> Tue, 27 Nov 2018 10:28:55 -0500
755+
756+nginx (1.15.6-0ubuntu2) disco; urgency=medium
757+
758+ * Apply a Debian packaging change to Ubuntu package for config parity:
759+ * d/conf/snippets/fastcgi-php.conf: Adjust fastcgi_split_path_info
760+ snippet to handle the /example.php/ case. (Debian bug 911398)
761+
762+ -- Thomas Ward <teward@ubuntu.com> Fri, 23 Nov 2018 10:56:21 -0500
763+
764+nginx (1.15.6-0ubuntu1) disco; urgency=medium
765+
766+ * New upstream release (1.15.6) - full changelog available from
767+ http://nginx.org/en/CHANGES
768+ * Remaining Ubuntu-specific changes:
769+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
770+ - d/{control,rules,nginx-core.*}: add new binary package for main,
771+ nginx-core, which contains only source-tarball-included modules
772+ and no third-party modules.
773+ - debian/tests/control: add nginx-core test.
774+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
775+ information gathering.
776+ - debian/nginx-common.install: Add install rule for apport hooks.
777+ - d/nginx-{core,light,full,extras}.postinst: Add checks for whether
778+ port 80 is in use or not to determine whether or not to attempt
779+ starting of the NGINX service during install/upgrade
780+ - d/control: Add dependencies to nginx-{core,light,full,extras} on
781+ `iproute2` as the postinst scripts now use `ss` to determine if
782+ Port 80 is open or not.
783+ - d/rules: Enable --with-compat build option for all nginx package
784+ flavors (LP: #1797897)
785+
786+ -- Thomas Ward <teward@ubuntu.com> Tue, 13 Nov 2018 10:10:45 -0500
787+
788+nginx (1.15.5-0ubuntu4) disco; urgency=medium
789+
790+ * No-change rebuild against libhiredis0.14
791+
792+ -- Steve Langasek <steve.langasek@ubuntu.com> Mon, 12 Nov 2018 08:47:44 +0000
793+
794+nginx (1.15.5-0ubuntu3) disco; urgency=medium
795+
796+ * No-change rebuild for the perl 5.28 transition.
797+
798+ -- Adam Conrad <adconrad@ubuntu.com> Fri, 02 Nov 2018 19:02:18 -0600
799+
800+nginx (1.15.5-0ubuntu2) cosmic; urgency=medium
801+
802+ * d/conf/nginx.conf: Enable TLSv1.3 by default by adding TLSv1.3 to
803+ the ssl_protocols line. (SRU, LP: #1800214)
804+
805+ -- Thomas Ward <teward@ubuntu.com> Fri, 26 Oct 2018 15:25:59 -0400
806+
807+nginx (1.15.5-0ubuntu1) cosmic; urgency=medium
808+
809+ * This is a bugfixes-only upstream micro release, and thus is a bugfixes-
810+ only version change. (LP: #1795690)
811+ * New upstream release (1.15.5) - full changelog available from
812+ http://nginx.org/en/CHANGES
813+ * Remaining Ubuntu-specific changes:
814+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
815+ - d/{control,rules,nginx-core.*}: add new binary package for main,
816+ nginx-core, which contains only source-tarball-included modules
817+ and no third-party modules.
818+ - debian/tests/control: add nginx-core test.
819+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
820+ information gathering.
821+ - debian/nginx-common.install: Add install rule for apport hooks.
822+ - d/nginx-{core,light,full,extras}.postinst: Add checks for whether
823+ port 80 is in use or not to determine whether or not to attempt
824+ starting of the NGINX service during install/upgrade
825+ - d/control: Add dependencies to nginx-{core,light,full,extras} on
826+ `iproute2` as the postinst scripts now use `ss` to determine if
827+ Port 80 is open or not.
828+
829+ -- Thomas Ward <teward@ubuntu.com> Tue, 02 Oct 2018 11:31:05 -0400
830+
831+nginx (1.15.4-0ubuntu1) cosmic; urgency=medium
832+
833+ * New upstream release (1.15.4) - full changelog available from
834+ http://nginx.org/en/CHANGES (LP: #1794321)
835+ * Remaining Ubuntu-specific changes:
836+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
837+ - d/{control,rules,nginx-core.*}: add new binary package for main,
838+ nginx-core, which contains only source-tarball-included modules
839+ and no third-party modules.
840+ - debian/tests/control: add nginx-core test.
841+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
842+ information gathering.
843+ - debian/nginx-common.install: Add install rule for apport hooks.
844+ - d/nginx-{core,light,full,extras}.postinst: Add checks for whether
845+ port 80 is in use or not to determine whether or not to attempt
846+ starting of the NGINX service during install/upgrade
847+ - d/control: Add dependencies to nginx-{core,light,full,extras} on
848+ `iproute2` as the postinst scripts now use `ss` to determine if
849+ Port 80 is open or not.
850+
851+ -- Thomas Ward <teward@ubuntu.com> Tue, 25 Sep 2018 11:59:46 -0400
852+
853+nginx (1.15.3-0ubuntu1) cosmic; urgency=medium
854+
855+ * New upstream release (1.15.3) - full changelog available from
856+ http://nginx.org/en/CHANGES (LP: #1790149)
857+ * Remaining Ubuntu-specific changes:
858+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
859+ - d/{control,rules,nginx-core.*}: add new binary package for main,
860+ nginx-core, which contains only source-tarball-included modules
861+ and no third-party modules.
862+ - debian/tests/control: add nginx-core test.
863+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
864+ information gathering.
865+ - debian/nginx-common.install: Add install rule for apport hooks.
866+ - d/nginx-{core,light,full,extras}.postinst: Add checks for whether
867+ port 80 is in use or not to determine whether or not to attempt
868+ starting of the NGINX service during install/upgrade
869+ - d/control: Add dependencies to nginx-{core,light,full,extras} on
870+ `iproute2` as the postinst scripts now use `ss` to determine if
871+ Port 80 is open or not.
872+
873+ -- Thomas Ward <teward@ubuntu.com> Fri, 31 Aug 2018 09:52:34 -0400
874+
875+nginx (1.15.2-0ubuntu2) cosmic; urgency=medium
876+
877+ * d/control: Add `iproute2` dependencies for the binary
878+ nginx-{core,light,full,extras} packages, they got missed in the
879+ application of the diff in 1.15.2-0ubuntu1. (LP: #1782226)
880+
881+ -- Thomas Ward <teward@ubuntu.com> Tue, 21 Aug 2018 12:07:59 -0400
882+
883+nginx (1.15.2-0ubuntu1) cosmic; urgency=medium
884+
885+ * Switch to track NGINX Mainline for 18.10 (and 19.04) releases after
886+ discussion with Server team members. Mainline version is 1.15.2
887+ * Upstream changelogs for 1.15.2 are available at
888+ http://nginx.org/en/CHANGES
889+ * Remaining Ubuntu-specific changes:
890+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
891+ - d/{control,rules,nginx-core.*}: add new binary package for main,
892+ nginx-core, which contains only source-tarball-included modules
893+ and no third-party modules.
894+ - debian/tests/control: add nginx-core test.
895+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
896+ information gathering.
897+ - debian/nginx-common.install: Add install rule for apport hooks.
898+ * Additional Ubuntu only changes (LP: #1782226):
899+ - d/nginx{core,light,full,extras}.postinst: Add checks for whether
900+ port 80 is in use or not to determine whether or not to attempt
901+ starting of the NGINX service during install/upgrade.
902+ - d/control: Add dependencies to nginx-{core,light,full,extras} on
903+ `iproute2` as the postinst scripts now use `ss` to determine if
904+ Port 80 is open or not.
905+
906+ -- Thomas Ward <teward@ubuntu.com> Sun, 19 Aug 2018 12:16:48 -0400
907+
908 nginx (1.14.2-3) unstable; urgency=high
909
910 * Backport upstream fixes for 3 CVEs (Closes: #935037)
911@@ -342,18 +1202,85 @@ nginx (1.14.0-1) unstable; urgency=medium
912
913 -- Christos Trochalakis <ctrochalakis@debian.org> Fri, 31 Aug 2018 15:28:04 +0300
914
915+nginx (1.14.0-0ubuntu2) cosmic; urgency=medium
916+
917+ * debian/nginx-core.postinst: Make nginx-*.postinst use invoke-rc.d.
918+ (LP: #1578344)
919+
920+ -- Thomas Ward <teward@ubuntu.com> Tue, 15 May 2018 11:14:02 -0400
921+
922+nginx (1.14.0-0ubuntu1) bionic; urgency=medium
923+
924+ * New upstream stable release (1.14.0)
925+ * Upstream changelogs can be found at http://nginx.org/en/CHANGES-1.14
926+ * There are no functional changes or new features in this release,
927+ and the only change is a version number change.
928+ * Remaining Ubuntu-specific changes:
929+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
930+ - d/{control,rules,nginx-core.*}: add new binary package for main,
931+ nginx-core, which contains only source-tarball-included modules
932+ and no third-party modules.
933+ - debian/tests/control: add nginx-core test.
934+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
935+ information gathering.
936+ - debian/nginx-common.install: Add install rule for apport hooks.
937+
938+ -- Thomas Ward <teward@ubuntu.com> Tue, 17 Apr 2018 12:17:58 -0400
939+
940 nginx (1.13.12-1) unstable; urgency=medium
941
942 * New upstream version
943
944 -- Christos Trochalakis <ctrochalakis@debian.org> Wed, 11 Apr 2018 08:19:23 +0300
945
946+nginx (1.13.12-0ubuntu1) bionic; urgency=medium
947+
948+ * New upstream releases (1.13.11, 1.13.12)
949+ * Upstream changelogs can be found at https://nginx.org/en/CHANGES
950+ * Remaining Ubuntu-specific changes:
951+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
952+ - d/{control,rules,nginx-core.*}: add new binary package for main,
953+ nginx-core, which contains only source-tarball-included modules
954+ and no third-party modules.
955+ - debian/tests/control: add nginx-core test.
956+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
957+ information gathering.
958+ - debian/nginx-common.install: Add install rule for apport hooks.
959+
960+ -- Thomas Ward <teward@ubuntu.com> Mon, 16 Apr 2018 11:43:01 -0400
961+
962 nginx (1.13.11-1) unstable; urgency=medium
963
964 * New upstream version
965
966 -- Christos Trochalakis <ctrochalakis@debian.org> Tue, 10 Apr 2018 14:55:11 +0300
967
968+nginx (1.13.10-1ubuntu1) bionic; urgency=medium
969+
970+ * Merge with Debian unstable. Remaining changes:
971+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
972+ - d/{control,rules,nginx-core.*}: add new binary package for main,
973+ nginx-core, which contains only source-tarball-included modules
974+ and no third-party modules.
975+ - debian/tests/control: add nginx-core test.
976+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
977+ information gathering.
978+ - debian/nginx-common.install: Add install rule for apport hooks.
979+ * Drop:
980+ - debian/patches/0002-Make-sure-signature-stays-the-same-in-
981+ all-nginx-buil.patch: Refreshed patch - Merge-o-Matic introduced some
982+ fuzz which caused issues.
983+ [ Does not seem necessary ]
984+ - d/control: drop mention of SSL Preread from nginx-full, nginx-extras
985+ [ Previously undocumented ]
986+ - d/gbp.conf: update for 1.12 release
987+ [ Previously undocumented ]
988+ - d/p/0003-define_gnu_source-on-other-glibc-based-platforms.patch:
989+ Refresh patch.
990+ [ Previously undocumented ]
991+
992+ -- Nishanth Aravamudan <nish.aravamudan@canonical.com> Thu, 05 Apr 2018 15:43:49 -0700
993+
994 nginx (1.13.10-1) unstable; urgency=medium
995
996 * New upstream version
997@@ -399,6 +1326,32 @@ nginx (1.13.7-1) unstable; urgency=medium
998
999 -- Christos Trochalakis <ctrochalakis@debian.org> Thu, 14 Dec 2017 11:04:36 +0200
1000
1001+nginx (1.13.6-2ubuntu2) bionic; urgency=high
1002+
1003+ * No change rebuild against openssl1.1.
1004+
1005+ -- Dimitri John Ledkov <xnox@ubuntu.com> Mon, 05 Feb 2018 16:51:17 +0000
1006+
1007+nginx (1.13.6-2ubuntu1) bionic; urgency=low
1008+
1009+ * Merge from Debian unstable. Remaining changes:
1010+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
1011+ - d/{control,rules,nginx-core.*}: add new binary package for main,
1012+ nginx-core, which contains only source-tarball-included modules
1013+ and no third-party modules.
1014+ - debian/tests/control: add nginx-core test.
1015+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
1016+ information gathering.
1017+ - debian/nginx-common.install: Add install rule for apport hooks.
1018+ - debian/rules: Alter build flags for cflags and ldflags to fix known
1019+ fPIE / fPIC compilation issues (see nginx PPA bug for more details
1020+ and information, LP: #1657596)
1021+ - debian/patches/0002-Make-sure-signature-stays-the-same-in-
1022+ all-nginx-buil.patch: Refreshed patch - Merge-o-Matic introduced some
1023+ fuzz which caused issues.
1024+
1025+ -- Thomas Ward <teward@ubuntu.com> Tue, 12 Dec 2017 12:15:30 -0500
1026+
1027 nginx (1.13.6-2) unstable; urgency=medium
1028
1029 * rtmp: Ship docs & examples (Closes: #878368)
1030@@ -486,6 +1439,37 @@ nginx (1.13.0-1) experimental; urgency=medium
1031
1032 -- Christos Trochalakis <ctrochalakis@debian.org> Wed, 10 May 2017 11:40:38 +0300
1033
1034+nginx (1.12.1-0ubuntu2) artful; urgency=medium
1035+
1036+ * No-change rebuild for perl 5.26.0.
1037+
1038+ -- Matthias Klose <doko@ubuntu.com> Wed, 26 Jul 2017 20:11:43 +0000
1039+
1040+nginx (1.12.1-0ubuntu1) artful; urgency=medium
1041+
1042+ * New upstream release (1.12.1) - full changelog available at upstream
1043+ website - http://nginx.org/en/CHANGES-1.12
1044+ * This release is a security patch micro-release from Upstream.
1045+ * This package contains security content to fix the following CVEs:
1046+ * CVE-2017-7529: A security issue was identified in nginx range filter.
1047+ A specially crafted request might result in an integer overflow and
1048+ incorrect processing of ranges, potentially resulting in sensitive
1049+ information leak. (Closes LP: #1704151)
1050+ * Additional changes:
1051+ * d/patches/ubuntu-branding.patch: Refreshed Ubuntu Branding patch.
1052+
1053+ -- Thomas Ward <teward@ubuntu.com> Sat, 15 Jul 2017 12:40:15 -0400
1054+
1055+nginx (1.12.0-1ubuntu1) artful; urgency=medium
1056+
1057+ * Merge from Debian Experimental (1.12.0-1, via snapshots.debian.org)
1058+ * All Ubuntu-specific changes from Ubuntu 1.12.0-0ubuntu1 were retained.
1059+ * Remaining changes:
1060+ * d/tests/control: Specify nginx-core flavor tests.
1061+ * This merge closes the merge request on Launchpad. (LP: #1704020)
1062+
1063+ -- Thomas Ward <teward@ubuntu.com> Wed, 12 Jul 2017 19:53:24 -0400
1064+
1065 nginx (1.12.0-1) experimental; urgency=medium
1066
1067 [ Michael Lustfield ]
1068@@ -506,6 +1490,90 @@ nginx (1.12.0-1) experimental; urgency=medium
1069
1070 -- Christos Trochalakis <ctrochalakis@debian.org> Fri, 05 May 2017 11:16:30 +0300
1071
1072+nginx (1.12.0-0ubuntu1) artful; urgency=medium
1073+
1074+ * New upstream release: 1.12.0 Stable branch.
1075+ * All remaining Ubuntu-specific and Debian-specific changes remain
1076+ in place with this upload, the upstream version and code are the
1077+ only bits that have been updated, except where indicated below.
1078+ * Remaining changes:
1079+ - d/modules/nginx-upload-progress/config: Apply upstream patch to
1080+ fix an issue where the module does not properly function due to
1081+ the wrong module type being set; this prevented the module from
1082+ working when built. (LP: #1673056)
1083+ - d/patches: The following patches were dropped from the package
1084+ because the changes from the patches are already incorporated
1085+ in 1.12.0:
1086+ - 0004-SSL-error-messages-style.patch
1087+ - 0005-SSL-style.patch
1088+ - 0006-SSL-support-for-multiple-curves-ticket-885.patch
1089+ - d/patches/perl-use-dpkg-buildflags.patch: Refreshed patch to
1090+ remove fuzz from the patch.
1091+ - d/modules/nginx-echo: Apply upstream diff/patch to fix an FTBFS
1092+ - d/modules/nginx-lua: Apply upstream diff/patch to fix an FTBFS
1093+ - d/modules/nginx-upstream-fair: Apply diff/patch from the Debian
1094+ package maintainers' git repository to not use default_port to
1095+ fix an FTBFS. (This will eventually be in Debian, and will get
1096+ merged in then as well).
1097+
1098+ -- Thomas Ward <teward@ubuntu.com> Wed, 26 Apr 2017 12:02:33 -0400
1099+
1100+nginx (1.12.0-1) UNRELEASED; urgency=medium
1101+
1102+ [ Michael Lustfield ]
1103+ * debian/rules:
1104+ - Configure build flags to work with other arches and downstreams.
1105+ Thanks to Thomas Ward.
1106+
1107+ [ Christos Trochalakis ]
1108+ * New upstream release.
1109+ * Patch nginx-upstream-fair to build against nginx 1.11.6.
1110+ * Patch nginx-lua to build against nginx 1.11.11.
1111+ * Patch nginx-echo to build against nginx 1.11.11.
1112+ * Drop curve list patch, it's included upstream.
1113+ * Drop perl build flags patch, it is now handled upstream.
1114+ * Enable SSL Preread builtin module on nginx-full & nginx-extras.
1115+ (Closes: #854214)
1116+ * Switch to debhelper 10, no changes needed.
1117+
1118+ -- Christos Trochalakis <ctrochalakis@debian.org> Fri, 28 Apr 2017 11:14:41 +0300
1119+
1120+nginx (1.10.3-1ubuntu3) zesty; urgency=medium
1121+
1122+ * debian/tests/control: Remove the 'ec-x25519' test stanzas from the
1123+ declarations of tests to run. This test requires OpenSSL >= 1.1.0
1124+ to support the X25519 ECDH curve, and we do not have OpenSSL 1.1.0.
1125+ This delta can be ***dropped*** when we do have OpenSSL >= 1.1.0.
1126+ - This fixes the autopkgtests, of which the Debian merge introduced
1127+ a regression due to the ec-x25519 test.
1128+
1129+ -- Thomas Ward <teward@ubuntu.com> Mon, 27 Feb 2017 19:51:57 -0500
1130+
1131+nginx (1.10.3-1ubuntu2) zesty; urgency=low
1132+
1133+ * debian/*.save: Junk .save left in the packaging, remove these.
1134+
1135+ -- Thomas Ward <teward@ubuntu.com> Thu, 16 Feb 2017 15:39:51 -0500
1136+
1137+nginx (1.10.3-1ubuntu1) zesty; urgency=medium
1138+
1139+ * Merge from Debian unstable (note: 1.10.3 already was merged, but 1.10.3
1140+ packaging changes in Debian were not). Remaining changes are as
1141+ follows: (LP: #1664652)
1142+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
1143+ - d/{control,rules,nginx-core.*}: add new binary package for main,
1144+ nginx-core, which contains only source-tarball-included modules
1145+ and no third-party modules.
1146+ - debian/tests/control: add nginx-core test.
1147+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
1148+ information gathering.
1149+ - debian/nginx-common.install: Add install rule for apport hooks.
1150+ - debian/rules: Alter build flags for cflags and ldflags to fix known
1151+ fPIE / fPIC compilation issues (see nginx PPA bug for more details
1152+ and information, LP: #1657596)
1153+
1154+ -- Thomas Ward <teward@ubuntu.com> Thu, 16 Feb 2017 15:29:40 -0500
1155+
1156 nginx (1.10.3-1) unstable; urgency=medium
1157
1158 * New upstream release. (Closes: #855113)
1159@@ -514,6 +1582,24 @@ nginx (1.10.3-1) unstable; urgency=medium
1160
1161 -- Christos Trochalakis <ctrochalakis@debian.org> Wed, 15 Feb 2017 09:58:13 +0200
1162
1163+nginx (1.10.3-0ubuntu2) zesty; urgency=low
1164+
1165+ * Merge from Debian unstable (nginx version there is 1.10.2-4). Remaining
1166+ changes: (LP: #1664652)
1167+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
1168+ - d/{control,rules,nginx-core.*}: add new binary package for main,
1169+ nginx-core, which contains only source-tarball-included modules
1170+ and no third-party modules.
1171+ - debian/tests/control: add nginx-core test.
1172+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
1173+ information gathering.
1174+ - debian/nginx-common.install: Add install rule for apport hooks.
1175+ - debian/rules: Alter build flags for cflags and ldflags to fix known
1176+ fPIE / fPIC compilation issues (see nginx PPA bug for more details
1177+ and information, LP: #1657596)
1178+
1179+ -- Thomas Ward <teward@ubuntu.com> Tue, 14 Feb 2017 17:47:00 -0500
1180+
1181 nginx (1.10.2-4) unstable; urgency=medium
1182
1183 * Switch module reloading logic to dpkg triggers.
1184@@ -586,6 +1672,18 @@ nginx (1.10.2-1) unstable; urgency=high
1185
1186 -- Christos Trochalakis <yatiohi@ideopolis.gr> Sat, 29 Oct 2016 08:45:09 +0300
1187
1188+nginx (1.10.2-0ubuntu1) zesty; urgency=medium
1189+
1190+ * New upstream release (1.10.2) - full changelog available at upstream
1191+ website - http://nginx.org/en/CHANGES-1.10 - upstream release date
1192+ was 18 Oct 2016
1193+ * All other changes from 1.10.1-0ubuntu1 through 1.10.1-0ubuntu5 remain
1194+ included
1195+ * debian/patches/ubuntu-branding.patch:
1196+ - Refreshed Ubuntu Branding patch.
1197+
1198+ -- Thomas Ward <teward@ubuntu.com> Thu, 15 Dec 2016 11:23:43 -0500
1199+
1200 nginx (1.10.1-3) unstable; urgency=medium
1201
1202 * debian/control:
1203@@ -647,6 +1745,58 @@ nginx (1.10.1-1) unstable; urgency=medium
1204
1205 -- Christos Trochalakis <yatiohi@ideopolis.gr> Tue, 31 May 2016 22:01:25 +0300
1206
1207+nginx (1.10.1-0ubuntu5) zesty; urgency=medium
1208+
1209+ * debian/nginx-common.config:
1210+ - Fix the return code so the script does not exit during version
1211+ string comparisons.
1212+ - Also update the version string to compare with (for zesty only)
1213+
1214+ -- Thomas Ward <teward@ubuntu.com> Thu, 27 Oct 2016 10:48:45 -0400
1215+
1216+nginx (1.10.1-0ubuntu4) zesty; urgency=medium
1217+
1218+ * debian/nginx-common.config:
1219+ - Fix an issue with the incorrect version numbers being compared
1220+ during configuration; this was something I missed when reviewing
1221+ the package for uploading previously. (LP: #1637058)
1222+
1223+ -- Thomas Ward <teward@ubuntu.com> Thu, 27 Oct 2016 08:45:40 -0400
1224+
1225+nginx (1.10.1-0ubuntu3) zesty; urgency=medium
1226+
1227+ [ Christos Trochalakis ]
1228+ * debian/nginx-common.postinst:
1229+ + Secure log file handling (owner & permissions) against privilege
1230+ escalation attacks. /var/log/nginx is now owned by root:adm.
1231+ Thanks Dawid Golunski (http://legalhackers.com) for the report.
1232+ Changing /var/log/nginx permissions effectively reopens #701112,
1233+ since log files can be world-readable. This is a trade-off until
1234+ a better log opening solution is implemented upstream (trac:376).
1235+ * debian/control:
1236+ Don't allow building against liblua5.1-0-dev on architectures
1237+ that libluajit is available.
1238+
1239+ -- Thomas Ward <teward@ubuntu.com> Tue, 25 Oct 2016 17:03:54 -0400
1240+
1241+nginx (1.10.1-0ubuntu2) zesty; urgency=medium
1242+
1243+ * No-change rebuild for perl 5.24 transition
1244+
1245+ -- Iain Lane <iain@orangesquash.org.uk> Mon, 24 Oct 2016 10:36:19 +0100
1246+
1247+nginx (1.10.1-0ubuntu1) yakkety; urgency=medium
1248+
1249+ * New upstream release (1.10.1) - full changelog available at upstream
1250+ website - http://nginx.org/en/CHANGES-1.10.
1251+ * Update done to address the following security issues:
1252+ - [CVE-2016-4450] NULL pointer dereference while writing client
1253+ request body. (LP: #1587577)
1254+ * Additional changes:
1255+ * debian/patches/ubuntu-branding.patch: Refreshed Ubuntu Branding patch.
1256+
1257+ -- Thomas Ward <teward@ubuntu.com> Tue, 31 May 2016 19:09:33 -0400
1258+
1259 nginx (1.10.0-1) unstable; urgency=medium
1260
1261 [ Christos Trochalakis ]
1262@@ -654,6 +1804,30 @@ nginx (1.10.0-1) unstable; urgency=medium
1263
1264 -- Christos Trochalakis <yatiohi@ideopolis.gr> Fri, 29 Apr 2016 10:31:46 +0300
1265
1266+nginx (1.10.0-0ubuntu1) yakkety; urgency=medium
1267+
1268+ * New upstream release (1.10.0) - full changelog available at upstream
1269+ website - http://nginx.org/en/CHANGES-1.10 (LP: #1575217)
1270+ * All Ubuntu specific changes from 1.9.15-0ubuntu1 remain included.
1271+ * Additional changes:
1272+ * debian/patches/ubuntu-branding.patch: Refreshed Ubuntu Branding patch.
1273+
1274+ -- Thomas Ward <teward@ubuntu.com> Tue, 26 Apr 2016 10:24:23 -0400
1275+
1276+nginx (1.9.15-0ubuntu1) xenial-proposed; urgency=medium
1277+
1278+ * New upstream release (1.9.15) - full changelog available at upstream
1279+ website - http://nginx.org/en/CHANGES (LP: #1572223)
1280+ * All Ubuntu specific changes from 1.1.14-0ubuntu1, except noted below,
1281+ remain included in this upload.
1282+ * Remaining changes:
1283+ * debian/control: Re-add libluajit-5.1-dev build-dependency, as it will
1284+ only affect nginx-extras which is in Universe. This reduces the merge
1285+ delta between Ubuntu and Debian slightly, as well. (LP: #1571444)
1286+ * debian/patches/ubuntu-branding.patch: Refresh Ubuntu Branding patch.
1287+
1288+ -- Thomas Ward <teward@ubuntu.com> Mon, 18 Apr 2016 15:39:08 -0400
1289+
1290 nginx (1.9.14-2) unstable; urgency=medium
1291
1292 [ Christos Trochalakis ]
1293@@ -697,6 +1871,84 @@ nginx (1.9.14-1) unstable; urgency=medium
1294
1295 -- Christos Trochalakis <yatiohi@ideopolis.gr> Tue, 19 Apr 2016 11:05:35 +0300
1296
1297+nginx (1.9.14-0ubuntu1) xenial-proposed; urgency=medium
1298+
1299+ * New upstream release (1.9.14) - full changelog available at upstream
1300+ website - htp://nginx.org/en/CHANGES (LP: #1566392)
1301+ * All Ubuntu specific changes from 1.9.13-0ubuntu1, except noted below,
1302+ remain included in this upload.
1303+ * Remaining changes:
1304+ * Enable HTTP/2 module for nginx-full, nginx-extras, and nginx-core
1305+ (LP: #1565043)
1306+ - debian/rules: Enable HTTP/2 module building in flavor rules
1307+ - debian/control: Add HTTP/2 module to package descriptions.
1308+ * debian/patches/ubuntu-branding.patch: Refresh Ubuntu Branding patch.
1309+
1310+ -- Thomas Ward <teward@ubuntu.com> Fri, 01 Apr 2016 14:23:47 -0400
1311+
1312+nginx (1.9.13-0ubuntu1) xenial-proposed; urgency=medium
1313+
1314+ * New upstream release (1.9.13) - full changelog available at upstream
1315+ website - http://nginx.org/en/CHANGES (LP: #1563393)
1316+ * All Ubuntu specific changes from 1.9.12-0ubuntu1 remain included in
1317+ this upload.
1318+ * debian/patches/ubuntu-branding.patch: Refresh Ubuntu Branding patch.
1319+
1320+ -- Thomas Ward <teward@ubuntu.com> Tue, 29 Mar 2016 18:47:36 -0400
1321+
1322+nginx (1.9.12-0ubuntu1) xenial; urgency=medium
1323+
1324+ * New upstream release (1.9.12) - full changelog available at upstream
1325+ website - http://nginx.org/en/CHANGES (LP: #1549347)
1326+ * All Ubuntu specific changes from 1.9.11-0ubuntu1 and -0ubuntu2 remain
1327+ included in this upload.
1328+
1329+ -- Thomas Ward <teward@ubuntu.com> Wed, 24 Feb 2016 10:26:31 -0500
1330+
1331+nginx (1.9.11-0ubuntu2) xenial; urgency=medium
1332+
1333+ * This is a bug-fix only upload and does not include any new changes to
1334+ features.
1335+ * debian/conf/sites-available/default: Modify PHP 'default example' settings
1336+ to account for php5 being replaced with php7.0 in Xenial. Also adapt the
1337+ UNIX socket path for php7.0-fpm to be the one used by default in Xenial.
1338+ (LP: #1547642)
1339+
1340+ -- Thomas Ward <teward@ubuntu.com> Fri, 19 Feb 2016 14:13:28 -0500
1341+
1342+nginx (1.9.11-0ubuntu1) xenial; urgency=low
1343+
1344+ * New upstream release (1.9.11) - see http://nginx.org/en/CHANGES for
1345+ full changelog.
1346+ * Ubuntu-specific changes from the 1.9.10 merge remain included here.
1347+ * Additional changes:
1348+ - debian/modules/nginx-lua: Apply upstream patch to fix FTBFS issue
1349+
1350+ -- Thomas Ward <teward@ubuntu.com> Tue, 09 Feb 2016 10:33:14 -0500
1351+
1352+nginx (1.9.10-1ubuntu1) xenial; urgency=low
1353+
1354+ * Merge from Debian unstable. Remaining changes: (LP: #1538677)
1355+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
1356+ - d/{control,rules,nginx-core.*}: add new binary package for main,
1357+ nginx-core, which contains only source-tarball-included modules
1358+ and no third-party modules.
1359+ - debian/tests/control: add nginx-core test.
1360+ - debian/control:
1361+ - drop luajit from Build-Depends as it is in universe.
1362+ - Remove HTTP/2 references in package descriptions, per Ubuntu
1363+ Security Team mandate to disable HTTP/2 support.
1364+ - debian/rules:
1365+ - Disable HTTP/2 module support in all flavors, per Ubuntu Security
1366+ Team mandate.
1367+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
1368+ information gathering.
1369+ - debian/nginx-common.install: Add install rule for apport hooks.
1370+ * Additional bugs fixed by this merge:
1371+ - nginx-common should not depend on python (LP: #1480513)
1372+
1373+ -- Thomas Ward <teward@ubuntu.com> Tue, 27 Jan 2016 12:52:00 -0500
1374+
1375 nginx (1.9.10-1) unstable; urgency=medium
1376
1377 [ Christos Trochalakis ]
1378@@ -706,6 +1958,54 @@ nginx (1.9.10-1) unstable; urgency=medium
1379
1380 -- Christos Trochalakis <yatiohi@ideopolis.gr> Tue, 26 Jan 2016 20:12:06 +0200
1381
1382+nginx (1.9.10-0ubuntu1) xenial; urgency=medium
1383+
1384+ * New upstream release.
1385+ * debian/patches/ubuntu-branding.patch: Refreshed Ubuntu Branding patch
1386+ * Security content of this upload addresses the following vulnerabilities
1387+ and CVE-numbered Security issues: (LP: #1538165)
1388+ - Invalid pointer dereference might occur during DNS server response
1389+ processing, allowing an attacker who is able to forge UDP
1390+ packets from the DNS server to cause worker process crash
1391+ (CVE-2016-0742).
1392+ - Use-after-free condition might occur during CNAME response
1393+ processing. This problem allows an attacker who is able to trigger
1394+ name resolution to cause worker process crash, or might
1395+ have potential other impact (CVE-2016-0746).
1396+ - CNAME resolution was insufficiently limited, allowing an attacker who
1397+ is able to trigger arbitrary name resolution to cause excessive resource
1398+ consumption in worker processes (CVE-2016-0747).
1399+
1400+ -- Thomas Ward <teward@ubuntu.com> Tue, 26 Jan 2016 14:53:01 -0500
1401+
1402+nginx (1.9.9-1ubuntu1) xenial; urgency=low
1403+
1404+ * Merge from Debian unstable. Remaining changes: (LP: #1534208)
1405+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
1406+ - d/{control,rules,nginx-core.*}: add new binary package for main,
1407+ nginx-core, which contains only source-tarball-included modules
1408+ and no third-party modules.
1409+ - debian/tests/control: add nginx-core test.
1410+ - debian/control:
1411+ - drop luajit from Build-Depends as it is in universe.
1412+ - Update nginx-core description to match nginx-full description of the
1413+ standard and optional HTTP modules that are enabled.
1414+ - Remove HTTP/2 references in package descriptions, per Ubuntu
1415+ Security Team mandate to disable HTTP/2 support.
1416+ - debian/rules:
1417+ - Update nginx-core configure flags to match nginx-full config flags,
1418+ due to refreshing the nginx-core 'enabled modules' to match the
1419+ nginx-full modules (minus third-party modules)
1420+ - Disable HTTP/2 module support in all flavors, per Ubuntu Security
1421+ Team mandate.
1422+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
1423+ information gathering.
1424+ - debian/nginx-common.install: Add install rule for apport hooks.
1425+ * debian/control: Remove HTTP/2 reference in nginx-extras description, which
1426+ was missed previously due to accidental oversight. (LP: #1534368)
1427+
1428+ -- Thomas Ward <teward@ubuntu.com> Thu, 14 Jan 2016 18:42:00 -0500
1429+
1430 nginx (1.9.9-1) unstable; urgency=medium
1431
1432 [ Michael Lustfield ]
1433@@ -719,6 +2019,46 @@ nginx (1.9.9-1) unstable; urgency=medium
1434
1435 -- Christos Trochalakis <yatiohi@ideopolis.gr> Thu, 14 Jan 2016 10:40:35 +0200
1436
1437+nginx (1.9.9-0ubuntu1) xenial; urgency=medium
1438+
1439+ * New upstream release.
1440+ * debian/patches/ubuntu-branding.patch: Refreshed Ubuntu Branding patch
1441+
1442+ -- Thomas Ward <teward@ubuntu.com> Sun, 03 Jan 2016 12:49:21 -0500
1443+
1444+nginx (1.9.6-2ubuntu2) xenial; urgency=medium
1445+
1446+ * Rebuild for Perl 5.22.1.
1447+
1448+ -- Colin Watson <cjwatson@ubuntu.com> Fri, 18 Dec 2015 12:53:05 +0000
1449+
1450+nginx (1.9.6-2ubuntu1) xenial; urgency=medium
1451+
1452+ * Merge from Debian unstable. Remaining changes: (LP: #1510096)
1453+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
1454+ - d/{control,rules,nginx-core.*}: add new binary package for main,
1455+ nginx-core, which contains only source-tarball-included modules
1456+ and no third-party modules.
1457+ - debian/tests/control: add nginx-core test.
1458+ - debian/control: drop luajit from Build-Depends as it is in universe.
1459+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
1460+ information gathering.
1461+ - debian/nginx-common.install: Add install rule for apport hooks.
1462+ * Additional changes:
1463+ * debian/rules:
1464+ - Update nginx-core configure flags to match nginx-full config flags,
1465+ due to refreshing the nginx-core 'enabled modules' to match the
1466+ nginx-full modules (minus third-party modules)
1467+ - Disable HTTP/2 module support in all flavors, per Ubuntu Security
1468+ Team mandate.
1469+ * debian/control:
1470+ - Update nginx-core description to match nginx-full description of the
1471+ standard and optional HTTP modules that are enabled.
1472+ - Remove HTTP/2 references in package descriptions, per Ubuntu
1473+ Security Team mandate to disable HTTP/2 support.
1474+
1475+ -- Thomas Ward <teward@ubuntu.com> Mon, 14 Dec 2015 10:34:42 -0500
1476+
1477 nginx (1.9.6-2) unstable; urgency=medium
1478
1479 [ Christos Trochalakis]
1480@@ -744,6 +2084,21 @@ nginx (1.9.4-1) unstable; urgency=medium
1481
1482 -- Christos Trochalakis <yatiohi@ideopolis.gr> Mon, 24 Aug 2015 16:23:20 +0300
1483
1484+nginx (1.9.3-1ubuntu1) wily; urgency=medium
1485+
1486+ * Merge from Debian. Remaining changes: (LP: #1476811)
1487+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
1488+ - d/{control,rules,nginx-core.*}: add new binary package for main,
1489+ nginx-core, which contains only source-tarball-included modules
1490+ and no third-party modules.
1491+ - debian/tests/control: add nginx-core test.
1492+ - debian/control: drop luajit from Build-Depends as it is in universe.
1493+ - debian/apport/source_nginx.py: Add apport hooks for additional bug
1494+ information gathering.
1495+ - debian/nginx-common.install: Add install rule for apport hooks.
1496+
1497+ -- Thomas Ward <teward@ubuntu.com> Wed, 22 Jul 2015 11:39:44 -0400
1498+
1499 nginx (1.9.3-1) unstable; urgency=medium
1500
1501 [ Christos Trochalakis]
1502@@ -828,6 +2183,52 @@ nginx (1.9.1-1) unstable; urgency=medium
1503
1504 -- Christos Trochalakis <yatiohi@ideopolis.gr> Fri, 12 Jun 2015 15:42:49 +0300
1505
1506+nginx (1.6.2-5ubuntu4) wily; urgency=medium
1507+
1508+ * debian/apport/source_nginx.py:
1509+ - Add apport hooks for additional bug information gathering, as a result
1510+ of non-useful reports due to postinstall script failure bugs. This is
1511+ necessary in order to be able to actually debug what is going on in the
1512+ bug reports, thanks to systemd not putting startup errors to stdout or
1513+ stderr anymore, like Upstart and others did. (LP: #1472683)
1514+ * debian/nginx-common.install:
1515+ - Add install rule for debian/apport/source_nginx.py, which is the new
1516+ apport hooks to gather additional 'Package' bugtype debug data.
1517+
1518+ -- Thomas Ward <teward@ubuntu.com> Fri, 10 Jul 2015 12:51:48 -0400
1519+
1520+nginx (1.6.2-5ubuntu3) vivid-proposed; urgency=medium
1521+
1522+ * debian/rules:
1523+ * Reversed Debian change in 1.6.2-5ubuntu2.
1524+ * Added DEB_BUILD_MAINT_OPTIONS=hardening=+all to enable all
1525+ dpkg-buildflags to harden the code, except for PIE flags.
1526+ * Manually define DEB_BUILD_MAINT_OPTIONS in DEBIAN_NGINX_PERL_LDFLAGS
1527+ to not have -fPIE conflicts in Perl flags.
1528+
1529+ -- Thomas Ward <teward@ubuntu.com> Wed, 01 Apr 2015 14:57:34 -0400
1530+
1531+nginx (1.6.2-5ubuntu2) vivid-proposed; urgency=medium
1532+
1533+ * debian/rules:
1534+ * Added -fPIE -pie to build rules (enables position-independent builds)
1535+ using Debian's committed change to enable. (LP: #1315426)
1536+
1537+ -- Thomas Ward <teward@ubuntu.com> Wed, 01 Apr 2015 14:26:32 -0400
1538+
1539+nginx (1.6.2-5ubuntu1) vivid; urgency=medium
1540+
1541+ * Merge from Debian. Remaining changes: (LP: #1399967)
1542+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding (refreshed)
1543+ - debian/rules: Drop from -O3 to -O2 to work around a build failure.
1544+ - d/{control,rules,nginx-core.*}: add new binary package for main,
1545+ nginx-core, which contains only source-tarball-included modules
1546+ and no third-party modules.
1547+ - debian/tests/control: add nginx-core test.
1548+ - debian/control: drop luajit from Build-Depends as it is in universe.
1549+
1550+ -- Thomas Ward <teward@ubuntu.com> Sat, 06 Dec 2014 13:06:55 -0500
1551+
1552 nginx (1.6.2-5) unstable; urgency=medium
1553
1554 [ Christos Trochalakis ]
1555@@ -843,6 +2244,27 @@ nginx (1.6.2-5) unstable; urgency=medium
1556
1557 -- Christos Trochalakis <yatiohi@ideopolis.gr> Sun, 30 Nov 2014 10:39:55 +0200
1558
1559+nginx (1.6.2-4ubuntu1) vivid; urgency=medium
1560+
1561+ * Merge from Debian. Remaining changes: (LP: #1388621)
1562+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding
1563+ (refreshed).
1564+ - debian/rules: Drop from -O3 to -O2 to work around a build failure.
1565+ - d/{control,rules,nginx-core.*}: add new binary package for main,
1566+ nginx-core, which contains only source-tarball-included modules
1567+ and no third-party modules.
1568+ - debian/tests/control: add nginx-core test.
1569+ - debian/control: drop luajit from Build-Depends as it is in universe.
1570+ * debian/control:
1571+ * Remove nginx-naxsi* from nginx-core and related
1572+ package stanzas, as the naxsi packages have all been dropped.
1573+ * Remove reference to nginx-naxsi from nginx metapackage description
1574+ * debian/index.html: Modify included index.html file to have Ubuntu
1575+ branding, Ubuntu bug reporting tool references, and a link to the
1576+ Launchpad bugs page for the nginx package.
1577+
1578+ -- Thomas Ward <teward@ubuntu.com> Wed, 05 Nov 2014 10:05:07 -0500
1579+
1580 nginx (1.6.2-4) unstable; urgency=medium
1581
1582 [ Christos Trochalakis ]
1583@@ -894,6 +2316,27 @@ nginx (1.6.2-2) unstable; urgency=medium
1584
1585 -- Christos Trochalakis <yatiohi@ideopolis.gr> Fri, 26 Sep 2014 11:06:47 +0300
1586
1587+nginx (1.6.2-1ubuntu1.1) utopic; urgency=medium
1588+
1589+ * debian/conf/sites-available/default: Remove SSLv3 from the ssl_protocols
1590+ line in the default config example, due to POODLE vulnerability.
1591+
1592+ -- Thomas Ward <teward@dark-net.net> Wed, 22 Oct 2014 09:43:35 -0400
1593+
1594+nginx (1.6.2-1ubuntu1) utopic; urgency=medium
1595+
1596+ * Merge from Debian. Remaining changes:
1597+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding
1598+ (refreshed).
1599+ - debian/rules: Drop from -O3 to -O2 to work around a build failure.
1600+ - d/{control,rules,nginx-core.*}: add new binary package for main,
1601+ nginx-core, which contains only source-tarball-included modules
1602+ and no third-party modules.
1603+ * debian/tests/control: add nginx-core test.
1604+ * debian/control: drop luajit from Build-Depends as it is in universe.
1605+
1606+ -- Marc Deslauriers <marc.deslauriers@ubuntu.com> Mon, 22 Sep 2014 13:32:30 -0400
1607+
1608 nginx (1.6.2-1) unstable; urgency=high
1609
1610 [ Christos Trochalakis ]
1611@@ -941,6 +2384,25 @@ nginx (1.6.1-2) unstable; urgency=medium
1612
1613 -- Christos Trochalakis <yatiohi@ideopolis.gr> Thu, 04 Sep 2014 13:00:46 +0300
1614
1615+nginx (1.6.1-1ubuntu2) utopic; urgency=medium
1616+
1617+ * Rebuild for Perl 5.20.0.
1618+
1619+ -- Colin Watson <cjwatson@ubuntu.com> Sun, 24 Aug 2014 06:43:36 -0700
1620+
1621+nginx (1.6.1-1ubuntu1) utopic; urgency=medium
1622+
1623+ * Merge from Debian. Remaining changes:
1624+ - debian/patches/ubuntu-branding.patch: add Ubuntu branding
1625+ (refreshed).
1626+ - debian/rules: Drop from -O3 to -O2 to work around a build failure.
1627+ - d/{control,rules,nginx-core.*}: add new binary package for main,
1628+ nginx-core, which contains only source-tarball-included modules
1629+ and no third-party modules.
1630+ * Add dep8 smoke test
1631+
1632+ -- Robie Basak <robie.basak@ubuntu.com> Fri, 15 Aug 2014 16:46:48 +0000
1633+
1634 nginx (1.6.1-1) unstable; urgency=medium
1635
1636 [ Christos Trochalakis ]
1637@@ -1006,6 +2468,34 @@ nginx (1.4.7-1) unstable; urgency=medium
1638
1639 -- Christos Trochalakis <yatiohi@ideopolis.gr> Tue, 18 Mar 2014 22:03:47 +0200
1640
1641+nginx (1.4.6-1ubuntu3) trusty; urgency=medium
1642+
1643+ * Add new binary package for main, nginx-core, which contains only
1644+ source-tarball-included modules and no third-party modules.
1645+ * Changes to debian/ directory:
1646+ - control:
1647+ + Add entry for nginx-core and nginx-core-dbg.
1648+ - rules:
1649+ + Add nginx-core flavor to the build rules.
1650+ - nginx-core.*: Add new packaging files for nginx-core based on
1651+ the packaging files for nginx-full.
1652+ * The above changes satisfy the requirements for main (LP: #1262710)
1653+
1654+ -- Thomas Ward <teward@ubuntu.com> Mon, 10 Mar 2014 18:23:36 -0400
1655+
1656+nginx (1.4.6-1ubuntu2) trusty; urgency=medium
1657+
1658+ * debian/rules: Drop from -O3 to -O2 to work around a build failure.
1659+
1660+ -- Adam Conrad <adconrad@ubuntu.com> Sun, 09 Mar 2014 11:49:28 -0600
1661+
1662+nginx (1.4.6-1ubuntu1) trusty; urgency=low
1663+
1664+ * Merge from Debian unstable. Remaining changes:
1665+ - debian/patches/ubuntu-branding.patch: Add Ubuntu branding.
1666+
1667+ -- Adam Conrad <adconrad@ubuntu.com> Sun, 09 Mar 2014 11:13:26 -0600
1668+
1669 nginx (1.4.6-1) unstable; urgency=medium
1670
1671 [ Christos Trochalakis ]
1672@@ -1027,6 +2517,14 @@ nginx (1.4.6-1) unstable; urgency=medium
1673
1674 -- Christos Trochalakis <yatiohi@ideopolis.gr> Tue, 04 Mar 2014 18:06:55 +0200
1675
1676+nginx (1.4.5-1ubuntu1) trusty; urgency=medium
1677+
1678+ * Resynchronise with Debian (LP: #1280511). Remaining changes:
1679+ - debian/patches/ubuntu-branding.patch:
1680+ + Add Ubuntu branding to server_tokens.
1681+
1682+ -- Colin Watson <cjwatson@ubuntu.com> Sat, 15 Feb 2014 03:05:42 +0000
1683+
1684 nginx (1.4.5-1) unstable; urgency=medium
1685
1686 [ Christos Trochalakis ]
1687@@ -1067,6 +2565,14 @@ nginx (1.4.4-3) unstable; urgency=medium
1688
1689 -- Christos Trochalakis <yatiohi@ideopolis.gr> Tue, 31 Dec 2013 11:47:07 +0200
1690
1691+nginx (1.4.4-2ubuntu1) trusty; urgency=medium
1692+
1693+ * Resynchronise with Debian. Remaining changes:
1694+ - debian/patches/ubuntu-branding.patch:
1695+ + Add Ubuntu branding to server_tokens.
1696+
1697+ -- Colin Watson <cjwatson@ubuntu.com> Sat, 28 Dec 2013 10:21:44 +0000
1698+
1699 nginx (1.4.4-2) unstable; urgency=low
1700
1701 [ Michael Lustfield ]
1702@@ -1104,6 +2610,14 @@ nginx (1.4.4-2) unstable; urgency=low
1703
1704 -- Kartik Mistry <kartik@debian.org> Fri, 27 Dec 2013 21:16:01 +0530
1705
1706+nginx (1.4.4-1ubuntu1) trusty; urgency=low
1707+
1708+ * Resynchronise with Debian (LP: #1253691). Remaining changes:
1709+ - debian/patches/ubuntu-branding.patch:
1710+ + Add Ubuntu branding to server_tokens.
1711+
1712+ -- Colin Watson <cjwatson@ubuntu.com> Fri, 22 Nov 2013 12:23:25 +0000
1713+
1714 nginx (1.4.4-1) unstable; urgency=low
1715
1716 [ Christos Trochalakis ]
1717@@ -1128,6 +2642,14 @@ nginx (1.4.4-1) unstable; urgency=low
1718
1719 -- Michael Lustfield <michael@lustfield.net> Thu, 21 Nov 2013 19:25:50 +0530
1720
1721+nginx (1.4.3-2ubuntu1) trusty; urgency=low
1722+
1723+ * Resynchronise with Debian. Remaining changes:
1724+ - debian/patches/ubuntu-branding.patch:
1725+ + Add Ubuntu branding to server_tokens.
1726+
1727+ -- Colin Watson <cjwatson@ubuntu.com> Mon, 21 Oct 2013 13:26:52 +0100
1728+
1729 nginx (1.4.3-2) unstable; urgency=low
1730
1731 [ Kartik Mistry ]
1732@@ -1184,6 +2706,14 @@ nginx (1.4.3-1) unstable; urgency=low
1733
1734 -- Kartik Mistry <kartik@debian.org> Thu, 10 Oct 2013 17:28:56 +0530
1735
1736+nginx (1.4.1-3ubuntu1) saucy; urgency=low
1737+
1738+ * Resynchronise with Debian. Remaining changes:
1739+ - debian/patches/ubuntu-branding.patch:
1740+ + Add Ubuntu branding to server_tokens.
1741+
1742+ -- Colin Watson <cjwatson@ubuntu.com> Thu, 20 Jun 2013 15:08:44 +0100
1743+
1744 nginx (1.4.1-3) unstable; urgency=low
1745
1746 [ Kartik Mistry ]
1747@@ -1197,6 +2727,14 @@ nginx (1.4.1-3) unstable; urgency=low
1748
1749 -- Kartik Mistry <kartik@debian.org> Sun, 09 Jun 2013 13:07:52 +0530
1750
1751+nginx (1.4.1-2ubuntu1) saucy; urgency=low
1752+
1753+ * Resynchronise with Debian. Remaining changes:
1754+ - debian/patches/ubuntu-branding.patch:
1755+ + Add Ubuntu branding to server_tokens.
1756+
1757+ -- Colin Watson <cjwatson@ubuntu.com> Fri, 07 Jun 2013 15:41:48 +0100
1758+
1759 nginx (1.4.1-2) unstable; urgency=medium
1760
1761 [ Kartik Mistry]
1762@@ -1218,6 +2756,24 @@ nginx (1.4.1-2) unstable; urgency=medium
1763
1764 -- Kartik Mistry <kartik@debian.org> Thu, 06 Jun 2013 12:55:23 +0530
1765
1766+nginx (1.4.1-1ubuntu2) saucy; urgency=low
1767+
1768+ * Rebuild for libgd3.
1769+
1770+ -- Colin Watson <cjwatson@ubuntu.com> Mon, 20 May 2013 00:45:10 +0100
1771+
1772+nginx (1.4.1-1ubuntu1) saucy; urgency=low
1773+
1774+ * Merge with Debian unstable (LP: #1177919). Remaining changes:
1775+ - debian/conf/sites-available/default:
1776+ + Modify default site configuration file to correct a typo
1777+ that prevented out-of-the-box usability (LP: #1162177).
1778+ - debian/patches/ubuntu-branding.patch:
1779+ + Add ubuntu branding to server_tokens.
1780+ * Refresh all patches.
1781+
1782+ -- Dmitry Shachnev <mitya57@ubuntu.com> Sat, 11 May 2013 14:47:53 +0400
1783+
1784 nginx (1.4.1-1) unstable; urgency=low
1785
1786 * New upstream release:
1787@@ -1295,6 +2851,36 @@ nginx (1.4.0-1) experimental; urgency=low
1788
1789 -- Kartik Mistry <kartik@debian.org> Thu, 25 Apr 2013 12:51:45 +0530
1790
1791+nginx (1.2.6-1ubuntu4) saucy; urgency=low
1792+
1793+ * debian/patches/ubuntu-branding.patch: Move Ubuntu branding from
1794+ the numerical version string to the long version (LP: #1174158)
1795+
1796+ -- Adam Conrad <adconrad@ubuntu.com> Thu, 09 May 2013 11:50:52 -0600
1797+
1798+nginx (1.2.6-1ubuntu3) raring; urgency=low
1799+
1800+ * debian/patches/ubuntu-branding.patch: Add ubuntu branding
1801+ to server_tokens.
1802+
1803+ -- Chuck Short <zulcss@ubuntu.com> Tue, 09 Apr 2013 10:23:26 -0500
1804+
1805+nginx (1.2.6-1ubuntu2) raring; urgency=low
1806+
1807+ * debian/conf/sites-available/default:
1808+ * Modify default site configuration file to correct a typo
1809+ that prevented out-of-the-box usability (LP: #1162177)
1810+
1811+ -- Thomas Ward <teward@ubuntu.com> Fri, 05 Apr 2013 20:22:38 +0100
1812+
1813+nginx (1.2.6-1ubuntu1) raring; urgency=low
1814+
1815+ * debian/conf/sites-available/default:
1816+ * Modify default site default configuration file to bind to IPv6
1817+ only for IPv6 default listen statement (LP: #1132678)
1818+
1819+ -- Thomas Ward <teward@ubuntu.com> Tue, 12 Mar 2013 00:23:02 +0000
1820+
1821 nginx (1.2.6-1) unstable; urgency=low
1822
1823 [ Kartik Mistry ]
1824diff --git a/debian/control b/debian/control
1825index c8aa03c..48a4115 100644
1826--- a/debian/control
1827+++ b/debian/control
1828@@ -1,7 +1,8 @@
1829 Source: nginx
1830 Section: httpd
1831 Priority: optional
1832-Maintainer: Debian Nginx Maintainers <pkg-nginx-maintainers@alioth-lists.debian.net>
1833+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
1834+XSBC-Original-Maintainer: Debian Nginx Maintainers <pkg-nginx-maintainers@alioth-lists.debian.net>
1835 Uploaders: Christos Trochalakis <ctrochalakis@debian.org>,
1836 Ondřej Nový <onovy@debian.org>,
1837 Thomas Ward <teward@ubuntu.com>,
1838@@ -11,8 +12,6 @@ Build-Depends: debhelper-compat (= 13),
1839 libgd-dev,
1840 libgeoip-dev,
1841 libhiredis-dev,
1842- liblua5.1-0-dev [!i386 !amd64 !kfreebsd-i386 !kfreebsd-amd64 !armel !armhf !powerpc !powerpcspe !mips !mipsel !mips64el !arm64 !ppc64 !s390x],
1843- libluajit-5.1-dev [i386 amd64 kfreebsd-i386 kfreebsd-amd64 armel armhf powerpc powerpcspe mips mipsel mips64el arm64 ppc64 s390x],
1844 libmaxminddb-dev,
1845 libmhash-dev,
1846 libpam0g-dev,
1847@@ -30,10 +29,12 @@ Vcs-Browser: https://salsa.debian.org/nginx-team/nginx
1848 Rules-Requires-Root: no
1849
1850 Package: nginx
1851-Architecture: all
1852+# See LP: #1893267
1853+Architecture: any
1854 Depends: nginx-core (<< ${source:Version}.1~) | nginx-full (<< ${source:Version}.1~) | nginx-light (<< ${source:Version}.1~) | nginx-extras (<< ${source:Version}.1~),
1855 nginx-core (>= ${source:Version}) | nginx-full (>= ${source:Version}) | nginx-light (>= ${source:Version}) | nginx-extras (>= ${source:Version}),
1856 ${misc:Depends}
1857+Breaks: libnginx-mod-http-lua (<< 1.18.0-6ubuntu5)
1858 Description: small, powerful, scalable web/proxy server
1859 Nginx ("engine X") is a high-performance web and reverse proxy server
1860 created by Igor Sysoev. It can be used both as a standalone web server
1861@@ -72,14 +73,11 @@ Architecture: all
1862 Depends: ${misc:Depends},
1863 debhelper-compat (= 13),
1864 dpkg-dev (>= 1.15.5),
1865- libgd-dev,
1866- libgeoip-dev,
1867 libpcre3-dev,
1868 libperl-dev,
1869 libssl-dev,
1870 libxslt1-dev,
1871 po-debconf,
1872- quilt,
1873 zlib1g-dev,
1874 nginx-core (<< ${source:Version}.1~) | nginx-light (<< ${source:Version}.1~) | nginx-extras (<< ${source:Version}.1~),
1875 nginx-core (>= ${source:Version}) | nginx-light (>= ${source:Version}) | nginx-extras (>= ${source:Version})
1876@@ -94,12 +92,12 @@ Description: nginx web/proxy server - development headers
1877
1878 Package: nginx-core
1879 Architecture: any
1880-Depends: libnginx-mod-http-geoip (= ${binary:Version}),
1881- libnginx-mod-http-image-filter (= ${binary:Version}),
1882+Depends: libnginx-mod-http-image-filter (= ${binary:Version}),
1883 libnginx-mod-http-xslt-filter (= ${binary:Version}),
1884+ libnginx-mod-http-geoip2 (= ${binary:Version}),
1885 libnginx-mod-mail (= ${binary:Version}),
1886 libnginx-mod-stream (= ${binary:Version}),
1887- libnginx-mod-stream-geoip (= ${binary:Version}),
1888+ libnginx-mod-stream-geoip2 (= ${binary:Version}),
1889 nginx-common (= ${source:Version}),
1890 iproute2,
1891 ${misc:Depends},
1892@@ -122,17 +120,20 @@ Description: nginx web/proxy server (standard version)
1893 GIF, FastCGI, Geo, Limit Connections, Limit Requests, Map, Memcached, Proxy,
1894 Referer, Rewrite, SCGI, Split Clients, UWSGI.
1895 .
1896- OPTIONAL HTTP MODULES: Addition, Auth Request, Charset, WebDAV, GeoIP, Gunzip,
1897+ OPTIONAL HTTP MODULES: Addition, Auth Request, Charset, WebDAV, Gunzip,
1898 Gzip, Gzip Precompression, Headers, HTTP/2, Image Filter, Index, Log, Real IP,
1899- Slice, SSI, SSL, SSL Preread, Stub Status, Substitution, Thread Pool,
1900+ Slice, SSI, SSL, SSL Preread, Stub Status, Substitution, Thread Pool,
1901 Upstream, User ID, XSLT.
1902 .
1903+ THIRD PARTY HTTP MODULES: GeoIP2
1904+ .
1905 OPTIONAL MAIL MODULES: Mail Core, Auth HTTP, Proxy, SSL, IMAP, POP3, SMTP.
1906 .
1907- OPTIONAL STREAM MODULES: Stream Core, GeoIP
1908+ OPTIONAL STREAM MODULES: Stream Core
1909
1910 Package: nginx-full
1911-Architecture: all
1912+# See LP: #1893267
1913+Architecture: any
1914 Depends: libnginx-mod-http-auth-pam,
1915 libnginx-mod-http-dav-ext,
1916 libnginx-mod-http-echo,
1917@@ -159,14 +160,14 @@ Description: nginx web/proxy server (standard version with 3rd parties)
1918 GIF, FastCGI, Geo, Limit Connections, Limit Requests, Map, Memcached, Proxy,
1919 Referer, Rewrite, SCGI, Split Clients, UWSGI.
1920 .
1921- OPTIONAL HTTP MODULES: Addition, Auth Request, Charset, WebDAV, GeoIP, Gunzip,
1922+ OPTIONAL HTTP MODULES: Addition, Auth Request, Charset, WebDAV, GeoIP2, Gunzip,
1923 Gzip, Gzip Precompression, Headers, HTTP/2, Image Filter, Index, Log, Real IP,
1924 Slice, SSI, SSL, Stream, SSL Preread, Stub Status, Substitution, Thread Pool,
1925 Upstream, User ID, XSLT.
1926 .
1927 OPTIONAL MAIL MODULES: Mail Core, Auth HTTP, Proxy, SSL, IMAP, POP3, SMTP.
1928 .
1929- OPTIONAL STREAM MODULES: Stream Core, GeoIP, GeoIP2
1930+ OPTIONAL STREAM MODULES: Stream Core
1931 .
1932 THIRD PARTY MODULES: Auth PAM, DAV Ext, Echo, GeoIP2, HTTP Substitutions
1933 Upstream Fair Queue.
1934@@ -174,6 +175,7 @@ Description: nginx web/proxy server (standard version with 3rd parties)
1935 Package: nginx-light
1936 Architecture: any
1937 Depends: libnginx-mod-http-echo (= ${binary:Version}),
1938+ libnginx-mod-http-geoip2 (= ${binary:Version}),
1939 nginx-common (= ${source:Version}),
1940 iproute2,
1941 ${misc:Depends},
1942@@ -196,7 +198,7 @@ Description: nginx web/proxy server (basic version)
1943 Headers, HTTP/2, Index, Log, Real IP, Slice, SSI, SSL, Stub Status, Thread
1944 Pool, WebDAV, Upstream.
1945 .
1946- THIRD PARTY MODULES: Echo.
1947+ THIRD PARTY MODULES: Echo, GeoIP2
1948
1949 Package: nginx-extras
1950 Architecture: any
1951@@ -209,7 +211,6 @@ Depends: libnginx-mod-http-auth-pam (= ${binary:Version}),
1952 libnginx-mod-http-geoip2 (= ${binary:Version}),
1953 libnginx-mod-http-headers-more-filter (= ${binary:Version}),
1954 libnginx-mod-http-image-filter (= ${binary:Version}),
1955- libnginx-mod-http-lua (= ${binary:Version}),
1956 libnginx-mod-http-perl (= ${binary:Version}),
1957 libnginx-mod-http-subs-filter (= ${binary:Version}),
1958 libnginx-mod-http-uploadprogress (= ${binary:Version}),
1959@@ -224,6 +225,10 @@ Depends: libnginx-mod-http-auth-pam (= ${binary:Version}),
1960 iproute2,
1961 ${misc:Depends},
1962 ${shlibs:Depends}
1963+<<<<<<< debian/control
1964+=======
1965+Breaks: nginx (<< 1.4.5-1), libnginx-mod-http-lua (<< 1.18.0-6ubuntu5)
1966+>>>>>>> debian/control
1967 Provides: httpd, httpd-cgi, nginx
1968 Conflicts: nginx-core, nginx-light
1969 Suggests: nginx-doc (= ${source:Version})
1970@@ -266,7 +271,7 @@ Description: GeoIP HTTP module for Nginx
1971
1972 Package: libnginx-mod-http-geoip2
1973 Architecture: any
1974-Depends: ${misc:Depends}, ${shlibs:Depends},
1975+Depends: ${misc:Depends}, ${shlibs:Depends}, libmaxminddb0
1976 Recommends: nginx,
1977 Description: GeoIP2 HTTP module for Nginx
1978 The ngx_http_geoip2 module creates variables with values depending on the
1979@@ -364,20 +369,6 @@ Description: PAM authentication module for Nginx
1980 The module uses PAM as a backend for simple http authentication. It
1981 also allows setting the pam service name to allow more fine grained control.
1982
1983-Package: libnginx-mod-http-lua
1984-Architecture: any
1985-Depends: libnginx-mod-http-ndk (= ${binary:Version}),
1986- ${misc:Depends},
1987- ${shlibs:Depends},
1988-Recommends: nginx,
1989-Description: Lua module for Nginx
1990- Embed Lua runtime into nginx.
1991- .
1992- This module embeds Lua, via the standard Lua 5.1 interpreter or LuaJIT
1993- 2.0/2.1, into Nginx and by leveraging Nginx's subrequests, allows the
1994- integration of the powerful Lua threads (Lua coroutines) into the Nginx event
1995- model.
1996-
1997 Package: libnginx-mod-http-ndk
1998 Architecture: any
1999 Depends: ${misc:Depends}, ${shlibs:Depends},
2000diff --git a/debian/copyright b/debian/copyright
2001index 6449e69..c061037 100644
2002--- a/debian/copyright
2003+++ b/debian/copyright
2004@@ -84,11 +84,6 @@ Files: debian/modules/http-echo/*
2005 Copyright: 2009-2014, Yichun "agentzh" Zhang <agentzh@gmail.com>
2006 License: BSD-2-clause
2007
2008-Files: debian/modules/http-lua/*
2009-Copyright: 2009-2017, by Xiaozhe Wang (chaoslawful) <chaoslawful@gmail.com>.
2010- 2009-2018, by Yichun "agentzh" Zhang (章亦春) <agentzh@gmail.com>, OpenResty Inc.
2011-License: BSD-2-clause
2012-
2013 Files: debian/modules/http-lua/t/lib/CRC32.lua
2014 Copyright: 2007-2008, Neil Richardson (nrich@iinet.net.au)
2015 License: Expat
2016diff --git a/debian/libnginx-mod-http-lua.nginx b/debian/libnginx-mod-http-lua.nginx
2017deleted file mode 100755
2018index 78c206f..0000000
2019--- a/debian/libnginx-mod-http-lua.nginx
2020+++ /dev/null
2021@@ -1,13 +0,0 @@
2022-#!/usr/bin/perl -w
2023-
2024-use File::Basename;
2025-
2026-# Guess module name
2027-$module = basename($0, '.nginx');
2028-$module =~ s/^libnginx-mod-//;
2029-
2030-$modulepath = $module;
2031-$modulepath =~ s/-/_/g;
2032-
2033-print "mod debian/build-extras/objs/ngx_${modulepath}_module.so\n";
2034-print "mod debian/libnginx-mod.conf/mod-${module}.conf\n";
2035diff --git a/debian/libnginx-mod.conf/mod-http-lua.conf b/debian/libnginx-mod.conf/mod-http-lua.conf
2036deleted file mode 100644
2037index f6311f4..0000000
2038--- a/debian/libnginx-mod.conf/mod-http-lua.conf
2039+++ /dev/null
2040@@ -1 +0,0 @@
2041-load_module modules/ngx_http_lua_module.so;
2042diff --git a/debian/modules/control b/debian/modules/control
2043index b3e517e..0e49194 100644
2044--- a/debian/modules/control
2045+++ b/debian/modules/control
2046@@ -20,14 +20,6 @@ Module: http-geoip2
2047 Homepage: https://github.com/leev/ngx_http_geoip2_module
2048 Version: 3.3
2049
2050-Module: http-lua
2051-Homepage: https://github.com/openresty/lua-nginx-module
2052-Version: v0.10.13
2053-Patch:
2054- openssl-1.1.0.patch
2055- discover-luajit-2.1.patch
2056-Files-Excluded: .gitignore .gitattributes .travis.yml .github
2057-
2058 Module: http-upstream-fair
2059 Homepage: https://github.com/gnosek/nginx-upstream-fair
2060 Version: a18b409
2061diff --git a/debian/modules/http-lua/README.markdown b/debian/modules/http-lua/README.markdown
2062deleted file mode 100644
2063index 15ad00e..0000000
2064--- a/debian/modules/http-lua/README.markdown
2065+++ /dev/null
2066@@ -1,8332 +0,0 @@
2067-<!---
2068-Don't edit this file manually! Instead you should generate it by using:
2069- wiki2markdown.pl doc/HttpLuaModule.wiki
2070--->
2071-
2072-Name
2073-====
2074-
2075-ngx_http_lua_module - Embed the power of Lua into Nginx HTTP Servers.
2076-
2077-*This module is not distributed with the Nginx source.* See [the installation instructions](#installation).
2078-
2079-Table of Contents
2080-=================
2081-
2082-* [Name](#name)
2083-* [Status](#status)
2084-* [Version](#version)
2085-* [Synopsis](#synopsis)
2086-* [Description](#description)
2087-* [Typical Uses](#typical-uses)
2088-* [Nginx Compatibility](#nginx-compatibility)
2089-* [Installation](#installation)
2090- * [Building as a dynamic module](#building-as-a-dynamic-module)
2091- * [C Macro Configurations](#c-macro-configurations)
2092- * [Installation on Ubuntu 11.10](#installation-on-ubuntu-1110)
2093-* [Community](#community)
2094- * [English Mailing List](#english-mailing-list)
2095- * [Chinese Mailing List](#chinese-mailing-list)
2096-* [Code Repository](#code-repository)
2097-* [Bugs and Patches](#bugs-and-patches)
2098-* [Lua/LuaJIT bytecode support](#lualuajit-bytecode-support)
2099-* [System Environment Variable Support](#system-environment-variable-support)
2100-* [HTTP 1.0 support](#http-10-support)
2101-* [Statically Linking Pure Lua Modules](#statically-linking-pure-lua-modules)
2102-* [Data Sharing within an Nginx Worker](#data-sharing-within-an-nginx-worker)
2103-* [Known Issues](#known-issues)
2104- * [TCP socket connect operation issues](#tcp-socket-connect-operation-issues)
2105- * [Lua Coroutine Yielding/Resuming](#lua-coroutine-yieldingresuming)
2106- * [Lua Variable Scope](#lua-variable-scope)
2107- * [Locations Configured by Subrequest Directives of Other Modules](#locations-configured-by-subrequest-directives-of-other-modules)
2108- * [Cosockets Not Available Everywhere](#cosockets-not-available-everywhere)
2109- * [Special Escaping Sequences](#special-escaping-sequences)
2110- * [Mixing with SSI Not Supported](#mixing-with-ssi-not-supported)
2111- * [SPDY Mode Not Fully Supported](#spdy-mode-not-fully-supported)
2112- * [Missing data on short circuited requests](#missing-data-on-short-circuited-requests)
2113-* [TODO](#todo)
2114-* [Changes](#changes)
2115-* [Test Suite](#test-suite)
2116-* [Copyright and License](#copyright-and-license)
2117-* [See Also](#see-also)
2118-* [Directives](#directives)
2119-* [Nginx API for Lua](#nginx-api-for-lua)
2120-* [Obsolete Sections](#obsolete-sections)
2121- * [Special PCRE Sequences](#special-pcre-sequences)
2122-
2123-Status
2124-======
2125-
2126-Production ready.
2127-
2128-Version
2129-=======
2130-
2131-This document describes ngx_lua [v0.10.13](https://github.com/openresty/lua-nginx-module/tags) released on 22 April 2018.
2132-
2133-Synopsis
2134-========
2135-```nginx
2136-
2137- # set search paths for pure Lua external libraries (';;' is the default path):
2138- lua_package_path '/foo/bar/?.lua;/blah/?.lua;;';
2139-
2140- # set search paths for Lua external libraries written in C (can also use ';;'):
2141- lua_package_cpath '/bar/baz/?.so;/blah/blah/?.so;;';
2142-
2143- server {
2144- location /lua_content {
2145- # MIME type determined by default_type:
2146- default_type 'text/plain';
2147-
2148- content_by_lua_block {
2149- ngx.say('Hello,world!')
2150- }
2151- }
2152-
2153- location /nginx_var {
2154- # MIME type determined by default_type:
2155- default_type 'text/plain';
2156-
2157- # try access /nginx_var?a=hello,world
2158- content_by_lua_block {
2159- ngx.say(ngx.var.arg_a)
2160- }
2161- }
2162-
2163- location = /request_body {
2164- client_max_body_size 50k;
2165- client_body_buffer_size 50k;
2166-
2167- content_by_lua_block {
2168- ngx.req.read_body() -- explicitly read the req body
2169- local data = ngx.req.get_body_data()
2170- if data then
2171- ngx.say("body data:")
2172- ngx.print(data)
2173- return
2174- end
2175-
2176- -- body may get buffered in a temp file:
2177- local file = ngx.req.get_body_file()
2178- if file then
2179- ngx.say("body is in file ", file)
2180- else
2181- ngx.say("no body found")
2182- end
2183- }
2184- }
2185-
2186- # transparent non-blocking I/O in Lua via subrequests
2187- # (well, a better way is to use cosockets)
2188- location = /lua {
2189- # MIME type determined by default_type:
2190- default_type 'text/plain';
2191-
2192- content_by_lua_block {
2193- local res = ngx.location.capture("/some_other_location")
2194- if res then
2195- ngx.say("status: ", res.status)
2196- ngx.say("body:")
2197- ngx.print(res.body)
2198- end
2199- }
2200- }
2201-
2202- location = /foo {
2203- rewrite_by_lua_block {
2204- res = ngx.location.capture("/memc",
2205- { args = { cmd = "incr", key = ngx.var.uri } }
2206- )
2207- }
2208-
2209- proxy_pass http://blah.blah.com;
2210- }
2211-
2212- location = /mixed {
2213- rewrite_by_lua_file /path/to/rewrite.lua;
2214- access_by_lua_file /path/to/access.lua;
2215- content_by_lua_file /path/to/content.lua;
2216- }
2217-
2218- # use nginx var in code path
2219- # CAUTION: contents in nginx var must be carefully filtered,
2220- # otherwise there'll be great security risk!
2221- location ~ ^/app/([-_a-zA-Z0-9/]+) {
2222- set $path $1;
2223- content_by_lua_file /path/to/lua/app/root/$path.lua;
2224- }
2225-
2226- location / {
2227- client_max_body_size 100k;
2228- client_body_buffer_size 100k;
2229-
2230- access_by_lua_block {
2231- -- check the client IP address is in our black list
2232- if ngx.var.remote_addr == "132.5.72.3" then
2233- ngx.exit(ngx.HTTP_FORBIDDEN)
2234- end
2235-
2236- -- check if the URI contains bad words
2237- if ngx.var.uri and
2238- string.match(ngx.var.request_body, "evil")
2239- then
2240- return ngx.redirect("/terms_of_use.html")
2241- end
2242-
2243- -- tests passed
2244- }
2245-
2246- # proxy_pass/fastcgi_pass/etc settings
2247- }
2248- }
2249-```
2250-
2251-[Back to TOC](#table-of-contents)
2252-
2253-Description
2254-===========
2255-
2256-This module embeds Lua, via the standard Lua 5.1 interpreter or [LuaJIT 2.0/2.1](http://luajit.org/luajit.html), into Nginx and by leveraging Nginx's subrequests, allows the integration of the powerful Lua threads (Lua coroutines) into the Nginx event model.
2257-
2258-Unlike [Apache's mod_lua](https://httpd.apache.org/docs/trunk/mod/mod_lua.html) and [Lighttpd's mod_magnet](http://redmine.lighttpd.net/wiki/1/Docs:ModMagnet), 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
2259-requests to upstream services such as MySQL, PostgreSQL, Memcached, Redis, or upstream HTTP web services.
2260-
2261-At least the following Lua libraries and Nginx modules can be used with this ngx_lua module:
2262-
2263-* [lua-resty-memcached](https://github.com/openresty/lua-resty-memcached)
2264-* [lua-resty-mysql](https://github.com/openresty/lua-resty-mysql)
2265-* [lua-resty-redis](https://github.com/openresty/lua-resty-redis)
2266-* [lua-resty-dns](https://github.com/openresty/lua-resty-dns)
2267-* [lua-resty-upload](https://github.com/openresty/lua-resty-upload)
2268-* [lua-resty-websocket](https://github.com/openresty/lua-resty-websocket)
2269-* [lua-resty-lock](https://github.com/openresty/lua-resty-lock)
2270-* [lua-resty-logger-socket](https://github.com/cloudflare/lua-resty-logger-socket)
2271-* [lua-resty-lrucache](https://github.com/openresty/lua-resty-lrucache)
2272-* [lua-resty-string](https://github.com/openresty/lua-resty-string)
2273-* [ngx_memc](http://github.com/openresty/memc-nginx-module)
2274-* [ngx_postgres](https://github.com/FRiCKLE/ngx_postgres)
2275-* [ngx_redis2](http://github.com/openresty/redis2-nginx-module)
2276-* [ngx_redis](http://wiki.nginx.org/HttpRedisModule)
2277-* [ngx_proxy](http://nginx.org/en/docs/http/ngx_http_proxy_module.html)
2278-* [ngx_fastcgi](http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html)
2279-
2280-Almost all the Nginx modules can be used with this ngx_lua module by means of [ngx.location.capture](#ngxlocationcapture) or [ngx.location.capture_multi](#ngxlocationcapture_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.
2281-
2282-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.
2283-
2284-Loaded Lua modules persist in the nginx worker process level resulting in a small memory footprint in Lua even when under heavy loads.
2285-
2286-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).
2287-If you want to do generic TCP communications with the downstream clients, then you should use the [ngx_stream_lua](https://github.com/openresty/stream-lua-nginx-module#readme) module instead
2288-which has a compatible Lua API.
2289-
2290-[Back to TOC](#table-of-contents)
2291-
2292-Typical Uses
2293-============
2294-
2295-Just to name a few:
2296-
2297-* Mashup'ing and processing outputs of various nginx upstream outputs (proxy, drizzle, postgres, redis, memcached, and etc) in Lua,
2298-* doing arbitrarily complex access control and security checks in Lua before requests actually reach the upstream backends,
2299-* manipulating response headers in an arbitrary way (by Lua)
2300-* 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,
2301-* coding up arbitrarily complex web applications in a content handler using synchronous but still non-blocking access to the database backends and other storage,
2302-* doing very complex URL dispatch in Lua at rewrite phase,
2303-* using Lua to implement advanced caching mechanism for Nginx's subrequests and arbitrary locations.
2304-
2305-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.
2306-
2307-Other scripting language implementations typically struggle to match this performance level.
2308-
2309-The Lua state (Lua VM instance) is shared across all the requests handled by a single nginx worker process to minimize memory use.
2310-
2311-[Back to TOC](#table-of-contents)
2312-
2313-Nginx Compatibility
2314-===================
2315-
2316-The latest version of this module is compatible with the following versions of Nginx:
2317-
2318-* 1.13.x (last tested: 1.13.6)
2319-* 1.12.x
2320-* 1.11.x (last tested: 1.11.2)
2321-* 1.10.x
2322-* 1.9.x (last tested: 1.9.15)
2323-* 1.8.x
2324-* 1.7.x (last tested: 1.7.10)
2325-* 1.6.x
2326-
2327-Nginx cores older than 1.6.0 (exclusive) are *not* supported.
2328-
2329-[Back to TOC](#table-of-contents)
2330-
2331-Installation
2332-============
2333-
2334-It is *highly* recommended to use [OpenResty releases](http://openresty.org) 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.
2335-
2336-Alternatively, ngx_lua can be manually compiled into Nginx:
2337-
2338-1. 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 [LuaJIT project website](http://luajit.org/download.html) and Lua 5.1, from the [Lua project website](http://www.lua.org/). Some distribution package managers also distribute LuaJIT and/or Lua.
2339-1. Download the latest version of the ngx_devel_kit (NDK) module [HERE](https://github.com/simplresty/ngx_devel_kit/tags).
2340-1. Download the latest version of ngx_lua [HERE](https://github.com/openresty/lua-nginx-module/tags).
2341-1. Download the latest version of Nginx [HERE](http://nginx.org/) (See [Nginx Compatibility](#nginx-compatibility))
2342-
2343-Build the source with this module:
2344-
2345-```bash
2346-
2347- wget 'http://nginx.org/download/nginx-1.13.6.tar.gz'
2348- tar -xzvf nginx-1.13.6.tar.gz
2349- cd nginx-1.13.6/
2350-
2351- # tell nginx's build system where to find LuaJIT 2.0:
2352- export LUAJIT_LIB=/path/to/luajit/lib
2353- export LUAJIT_INC=/path/to/luajit/include/luajit-2.0
2354-
2355- # tell nginx's build system where to find LuaJIT 2.1:
2356- export LUAJIT_LIB=/path/to/luajit/lib
2357- export LUAJIT_INC=/path/to/luajit/include/luajit-2.1
2358-
2359- # or tell where to find Lua if using Lua instead:
2360- #export LUA_LIB=/path/to/lua/lib
2361- #export LUA_INC=/path/to/lua/include
2362-
2363- # Here we assume Nginx is to be installed under /opt/nginx/.
2364- ./configure --prefix=/opt/nginx \
2365- --with-ld-opt="-Wl,-rpath,/path/to/luajit-or-lua/lib" \
2366- --add-module=/path/to/ngx_devel_kit \
2367- --add-module=/path/to/lua-nginx-module
2368-
2369- # Note that you may also want to add `./configure` options which are used in your
2370- # current nginx build.
2371- # You can get usually those options using command nginx -V
2372-
2373- # you can change the parallism number 2 below to fit the number of spare CPU cores in your
2374- # machine.
2375- make -j2
2376- make install
2377-```
2378-
2379-[Back to TOC](#table-of-contents)
2380-
2381-Building as a dynamic module
2382-----------------------------
2383-
2384-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
2385-`./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)
2386-directive, for example,
2387-
2388-```nginx
2389-
2390- load_module /path/to/modules/ndk_http_module.so; # assuming NDK is built as a dynamic module too
2391- load_module /path/to/modules/ngx_http_lua_module.so;
2392-```
2393-
2394-[Back to TOC](#table-of-contents)
2395-
2396-C Macro Configurations
2397-----------------------
2398-
2399-While building this module either via OpenResty or with the NGINX core, you can define the following C macros via the C compiler options:
2400-
2401-* `NGX_LUA_USE_ASSERT`
2402- 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.
2403-* `NGX_LUA_ABORT_AT_PANIC`
2404- 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.
2405-* `NGX_LUA_NO_FFI_API`
2406- Excludes pure C API functions for FFI-based Lua API for NGINX (as required by [lua-resty-core](https://github.com/openresty/lua-resty-core#readme), for example). Enabling this macro can make the resulting binary code size smaller.
2407-
2408-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,
2409-
2410-
2411- ./configure --with-cc-opt="-DNGX_LUA_USE_ASSERT -DNGX_LUA_ABORT_AT_PANIC"
2412-
2413-
2414-[Back to TOC](#table-of-contents)
2415-
2416-Installation on Ubuntu 11.10
2417-----------------------------
2418-
2419-Note that it is recommended to use LuaJIT 2.0 or LuaJIT 2.1 instead of the standard Lua 5.1 interpreter wherever possible.
2420-
2421-If the standard Lua 5.1 interpreter is required however, run the following command to install it from the Ubuntu repository:
2422-
2423-```bash
2424-
2425- apt-get install -y lua5.1 liblua5.1-0 liblua5.1-0-dev
2426-```
2427-
2428-Everything should be installed correctly, except for one small tweak.
2429-
2430-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.
2431-
2432-```bash
2433-
2434- ln -s /usr/lib/x86_64-linux-gnu/liblua5.1.so /usr/lib/liblua.so
2435-```
2436-
2437-[Back to TOC](#table-of-contents)
2438-
2439-Community
2440-=========
2441-
2442-[Back to TOC](#table-of-contents)
2443-
2444-English Mailing List
2445---------------------
2446-
2447-The [openresty-en](https://groups.google.com/group/openresty-en) mailing list is for English speakers.
2448-
2449-[Back to TOC](#table-of-contents)
2450-
2451-Chinese Mailing List
2452---------------------
2453-
2454-The [openresty](https://groups.google.com/group/openresty) mailing list is for Chinese speakers.
2455-
2456-[Back to TOC](#table-of-contents)
2457-
2458-Code Repository
2459-===============
2460-
2461-The code repository of this project is hosted on github at [openresty/lua-nginx-module](https://github.com/openresty/lua-nginx-module).
2462-
2463-[Back to TOC](#table-of-contents)
2464-
2465-Bugs and Patches
2466-================
2467-
2468-Please submit bug reports, wishlists, or patches by
2469-
2470-1. creating a ticket on the [GitHub Issue Tracker](https://github.com/openresty/lua-nginx-module/issues),
2471-1. or posting to the [OpenResty community](#community).
2472-
2473-[Back to TOC](#table-of-contents)
2474-
2475-Lua/LuaJIT bytecode support
2476-===========================
2477-
2478-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.
2479-
2480-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:
2481-
2482-```bash
2483-
2484- /path/to/luajit/bin/luajit -b /path/to/input_file.lua /path/to/output_file.ljbc
2485-```
2486-
2487-The `-bg` option can be used to include debug information in the LuaJIT bytecode file:
2488-
2489-```bash
2490-
2491- /path/to/luajit/bin/luajit -bg /path/to/input_file.lua /path/to/output_file.ljbc
2492-```
2493-
2494-Please refer to the official LuaJIT documentation on the `-b` option for more details:
2495-
2496-<http://luajit.org/running.html#opt_b>
2497-
2498-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.
2499-
2500-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:
2501-
2502-```bash
2503-
2504- luac -o /path/to/output_file.luac /path/to/input_file.lua
2505-```
2506-
2507-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:
2508-
2509-```bash
2510-
2511- luac -s -o /path/to/output_file.luac /path/to/input_file.lua
2512-```
2513-
2514-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:
2515-
2516-
2517- [error] 13909#0: *1 failed to load Lua inlined code: bad byte-code header in /path/to/test_file.luac
2518-
2519-
2520-Loading bytecode files via the Lua primitives like `require` and `dofile` should always work as expected.
2521-
2522-[Back to TOC](#table-of-contents)
2523-
2524-System Environment Variable Support
2525-===================================
2526-
2527-If you want to access the system environment variable, say, `foo`, in Lua via the standard Lua API [os.getenv](http://www.lua.org/manual/5.1/manual.html#pdf-os.getenv), then you should also list this environment variable name in your `nginx.conf` file via the [env directive](http://nginx.org/en/docs/ngx_core_module.html#env). For example,
2528-
2529-```nginx
2530-
2531- env foo;
2532-```
2533-
2534-[Back to TOC](#table-of-contents)
2535-
2536-HTTP 1.0 support
2537-================
2538-
2539-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.
2540-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
2541-output of [ngx.say](#ngxsay) and [ngx.print](#ngxprint) calls and also postpone sending response headers until all the response body output is received.
2542-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.
2543-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`.
2544-
2545-For large streaming output responses, it is important to disable the [lua_http10_buffering](#lua_http10_buffering) directive to minimise memory usage.
2546-
2547-Note that common HTTP benchmark tools such as `ab` and `http_load` issue HTTP 1.0 requests by default.
2548-To force `curl` to send HTTP 1.0 requests, use the `-0` option.
2549-
2550-[Back to TOC](#table-of-contents)
2551-
2552-Statically Linking Pure Lua Modules
2553-===================================
2554-
2555-When LuaJIT 2.x is used, it is possible to statically link the bytecode of pure Lua modules into the Nginx executable.
2556-
2557-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.
2558-
2559-Below is a trivial example to demonstrate this. Consider that we have the following `.lua` file named `foo.lua`:
2560-
2561-```lua
2562-
2563- -- foo.lua
2564- local _M = {}
2565-
2566- function _M.go()
2567- print("Hello from foo")
2568- end
2569-
2570- return _M
2571-```
2572-
2573-And then we compile this `.lua` file to `foo.o` file:
2574-
2575- /path/to/luajit/bin/luajit -bg foo.lua foo.o
2576-
2577-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`.
2578-
2579-Then when building Nginx or OpenResty, pass the `--with-ld-opt="foo.o"` option to the `./configure` script:
2580-
2581-```bash
2582-
2583- ./configure --with-ld-opt="/path/to/foo.o" ...
2584-```
2585-
2586-Finally, you can just do the following in any Lua code run by ngx_lua:
2587-
2588-```lua
2589-
2590- local foo = require "foo"
2591- foo.go()
2592-```
2593-
2594-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.
2595-
2596-If you want to use dot in the Lua module name when calling `require`, as in
2597-
2598-```lua
2599-
2600- local foo = require "resty.foo"
2601-```
2602-
2603-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.
2604-
2605-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.
2606-
2607-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,
2608-
2609-```bash
2610-
2611- ./configure --with-ld-opt="/path/to/foo.o /path/to/bar.o" ...
2612-```
2613-
2614-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
2615-
2616-```bash
2617-
2618- ar rcus libmyluafiles.a *.o
2619-```
2620-
2621-then you can link the `myluafiles` archive as a whole to your nginx executable:
2622-
2623-```bash
2624-
2625- ./configure \
2626- --with-ld-opt="-L/path/to/lib -Wl,--whole-archive -lmyluafiles -Wl,--no-whole-archive"
2627-```
2628-
2629-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.
2630-
2631-[Back to TOC](#table-of-contents)
2632-
2633-Data Sharing within an Nginx Worker
2634-===================================
2635-
2636-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.
2637-
2638-Here is a complete small example:
2639-
2640-```lua
2641-
2642- -- mydata.lua
2643- local _M = {}
2644-
2645- local data = {
2646- dog = 3,
2647- cat = 4,
2648- pig = 5,
2649- }
2650-
2651- function _M.get_age(name)
2652- return data[name]
2653- end
2654-
2655- return _M
2656-```
2657-
2658-and then accessing it from `nginx.conf`:
2659-
2660-```nginx
2661-
2662- location /lua {
2663- content_by_lua_block {
2664- local mydata = require "mydata"
2665- ngx.say(mydata.get_age("dog"))
2666- }
2667- }
2668-```
2669-
2670-The `mydata` module in this example will only be loaded and run on the first request to the location `/lua`,
2671-and all subsequent requests to the same nginx worker process will use the reloaded instance of the
2672-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.
2673-This data sharing technique is essential for high performance Lua applications based on this module.
2674-
2675-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.
2676-
2677-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
2678-long as there is *no* nonblocking I/O operations (including [ngx.sleep](#ngxsleep))
2679-in the middle of your calculations. As long as you do not give the
2680-control back to the nginx event loop and ngx_lua's light thread
2681-scheduler (even implicitly), there can never be any race conditions in
2682-between. For this reason, always be very careful when you want to share changeable data on the
2683-worker level. Buggy optimizations can easily lead to hard-to-debug
2684-race conditions under load.
2685-
2686-If server-wide data sharing is required, then use one or more of the following approaches:
2687-
2688-1. Use the [ngx.shared.DICT](#ngxshareddict) API provided by this module.
2689-1. 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).
2690-1. Use data storage mechanisms such as `memcached`, `redis`, `MySQL` or `PostgreSQL`. [The OpenResty bundle](http://openresty.org) associated with this module comes with a set of companion Nginx modules and Lua libraries that provide interfaces with these data storage mechanisms.
2691-
2692-[Back to TOC](#table-of-contents)
2693-
2694-Known Issues
2695-============
2696-
2697-[Back to TOC](#table-of-contents)
2698-
2699-TCP socket connect operation issues
2700------------------------------------
2701-The [tcpsock:connect](#tcpsockconnect) method may indicate `success` despite connection failures such as with `Connection Refused` errors.
2702-
2703-However, later attempts to manipulate the cosocket object will fail and return the actual error status message generated by the failed connect operation.
2704-
2705-This issue is due to limitations in the Nginx event model and only appears to affect Mac OS X.
2706-
2707-[Back to TOC](#table-of-contents)
2708-
2709-Lua Coroutine Yielding/Resuming
2710--------------------------------
2711-* 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*](#ngxlocationcapture), [ngx.exec](#ngxexec), [ngx.exit](#ngxexit), 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.
2712-* As the standard Lua 5.1 interpreter's VM is not fully resumable, the methods [ngx.location.capture](#ngxlocationcapture), [ngx.location.capture_multi](#ngxlocationcapture_multi), [ngx.redirect](#ngxredirect), [ngx.exec](#ngxexec), and [ngx.exit](#ngxexit) cannot be used within the context of a Lua [pcall()](http://www.lua.org/manual/5.1/manual.html#pdf-pcall) or [xpcall()](http://www.lua.org/manual/5.1/manual.html#pdf-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.
2713-
2714-[Back to TOC](#table-of-contents)
2715-
2716-Lua Variable Scope
2717-------------------
2718-Care must be taken when importing modules and this form should be used:
2719-
2720-```lua
2721-
2722- local xxx = require('xxx')
2723-```
2724-
2725-instead of the old deprecated form:
2726-
2727-```lua
2728-
2729- require('xxx')
2730-```
2731-
2732-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.
2733-
2734-The use of Lua global variables is a generally inadvisable in the ngx_lua context as:
2735-
2736-1. the misuse of Lua globals has detrimental side effects on concurrent requests when such variables should instead be local in scope,
2737-1. Lua global variables require Lua table look-ups in the global environment which is computationally expensive, and
2738-1. some Lua global variable references may include typing errors which make such difficult to debug.
2739-
2740-It is therefore *highly* recommended to always declare such within an appropriate local scope instead.
2741-
2742-```lua
2743-
2744- -- Avoid
2745- foo = 123
2746- -- Recommended
2747- local foo = 123
2748-
2749- -- Avoid
2750- function foo() return 123 end
2751- -- Recommended
2752- local function foo() return 123 end
2753-```
2754-
2755-
2756-To find all instances of Lua global variables in your Lua code, run the [lua-releng tool](https://github.com/openresty/nginx-devel-utils/blob/master/lua-releng) across all `.lua` source files:
2757-
2758- $ lua-releng
2759- Checking use of Lua global variables in file lib/foo/bar.lua ...
2760- 1 [1489] SETGLOBAL 7 -1 ; contains
2761- 55 [1506] GETGLOBAL 7 -3 ; setvar
2762- 3 [1545] GETGLOBAL 3 -4 ; varexpand
2763-
2764-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`.
2765-
2766-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.
2767-
2768-[Back to TOC](#table-of-contents)
2769-
2770-Locations Configured by Subrequest Directives of Other Modules
2771---------------------------------------------------------------
2772-The [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi) directives cannot capture locations that include the [add_before_body](http://nginx.org/en/docs/http/ngx_http_addition_module.html#add_before_body), [add_after_body](http://nginx.org/en/docs/http/ngx_http_addition_module.html#add_after_body), [auth_request](http://nginx.org/en/docs/http/ngx_http_auth_request_module.html#auth_request), [echo_location](http://github.com/openresty/echo-nginx-module#echo_location), [echo_location_async](http://github.com/openresty/echo-nginx-module#echo_location_async), [echo_subrequest](http://github.com/openresty/echo-nginx-module#echo_subrequest), or [echo_subrequest_async](http://github.com/openresty/echo-nginx-module#echo_subrequest_async) directives.
2773-
2774-```nginx
2775-
2776- location /foo {
2777- content_by_lua_block {
2778- res = ngx.location.capture("/bar")
2779- }
2780- }
2781- location /bar {
2782- echo_location /blah;
2783- }
2784- location /blah {
2785- echo "Success!";
2786- }
2787-```
2788-
2789-```nginx
2790-
2791- $ curl -i http://example.com/foo
2792-```
2793-
2794-will not work as expected.
2795-
2796-[Back to TOC](#table-of-contents)
2797-
2798-Cosockets Not Available Everywhere
2799-----------------------------------
2800-
2801-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).
2802-
2803-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).
2804-
2805-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](#ngxtimerat) API and do the cosocket results in the timer handler, which runs asynchronously as to the original context creating the timer.
2806-
2807-[Back to TOC](#table-of-contents)
2808-
2809-Special Escaping Sequences
2810---------------------------
2811-
2812-**NOTE** Following the `v0.9.17` release, this pitfall can be avoided by using the `*_by_lua_block {}` configuration directives.
2813-
2814-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:
2815-
2816-```nginx
2817-
2818- # nginx.conf
2819- ? location /test {
2820- ? content_by_lua '
2821- ? local regex = "\d+" -- THIS IS WRONG OUTSIDE OF A *_by_lua_block DIRECTIVE
2822- ? local m = ngx.re.match("hello, 1234", regex)
2823- ? if m then ngx.say(m[0]) else ngx.say("not matched!") end
2824- ? ';
2825- ? }
2826- # evaluates to "not matched!"
2827-```
2828-
2829-To avoid this, *double* escape the backslash:
2830-
2831-```nginx
2832-
2833- # nginx.conf
2834- location /test {
2835- content_by_lua '
2836- local regex = "\\\\d+"
2837- local m = ngx.re.match("hello, 1234", regex)
2838- if m then ngx.say(m[0]) else ngx.say("not matched!") end
2839- ';
2840- }
2841- # evaluates to "1234"
2842-```
2843-
2844-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.
2845-
2846-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.
2847-
2848-```nginx
2849-
2850- # nginx.conf
2851- location /test {
2852- content_by_lua '
2853- local regex = [[\\d+]]
2854- local m = ngx.re.match("hello, 1234", regex)
2855- if m then ngx.say(m[0]) else ngx.say("not matched!") end
2856- ';
2857- }
2858- # evaluates to "1234"
2859-```
2860-
2861-Here, `[[\\d+]]` is stripped down to `[[\d+]]` by the Nginx config file parser and this is processed correctly.
2862-
2863-Note that a longer from of the long bracket, `[=[...]=]`, may be required if the regex pattern contains `[...]` sequences.
2864-The `[=[...]=]` form may be used as the default form if desired.
2865-
2866-```nginx
2867-
2868- # nginx.conf
2869- location /test {
2870- content_by_lua '
2871- local regex = [=[[0-9]+]=]
2872- local m = ngx.re.match("hello, 1234", regex)
2873- if m then ngx.say(m[0]) else ngx.say("not matched!") end
2874- ';
2875- }
2876- # evaluates to "1234"
2877-```
2878-
2879-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.
2880-With this approach, the backslashes are only stripped by the Lua language parser and therefore only need to be escaped once each.
2881-
2882-```lua
2883-
2884- -- test.lua
2885- local regex = "\\d+"
2886- local m = ngx.re.match("hello, 1234", regex)
2887- if m then ngx.say(m[0]) else ngx.say("not matched!") end
2888- -- evaluates to "1234"
2889-```
2890-
2891-Within external script files, PCRE sequences presented as long-bracketed Lua string literals do not require modification.
2892-
2893-```lua
2894-
2895- -- test.lua
2896- local regex = [[\d+]]
2897- local m = ngx.re.match("hello, 1234", regex)
2898- if m then ngx.say(m[0]) else ngx.say("not matched!") end
2899- -- evaluates to "1234"
2900-```
2901-
2902-As noted earlier, PCRE sequences presented within `*_by_lua_block {}` directives (available following the `v0.9.17` release) do not require modification.
2903-
2904-```nginx
2905-
2906- # nginx.conf
2907- location /test {
2908- content_by_lua_block {
2909- local regex = [[\d+]]
2910- local m = ngx.re.match("hello, 1234", regex)
2911- if m then ngx.say(m[0]) else ngx.say("not matched!") end
2912- }
2913- }
2914- # evaluates to "1234"
2915-```
2916-
2917-
2918-[Back to TOC](#table-of-contents)
2919-
2920-Mixing with SSI Not Supported
2921------------------------------
2922-
2923-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.
2924-
2925-[Back to TOC](#table-of-contents)
2926-
2927-SPDY Mode Not Fully Supported
2928------------------------------
2929-
2930-Certain Lua APIs provided by ngx_lua do not work in Nginx's SPDY mode yet: [ngx.location.capture](#ngxlocationcapture), [ngx.location.capture_multi](#ngxlocationcapture_multi), and [ngx.req.socket](#ngxreqsocket).
2931-
2932-[Back to TOC](#table-of-contents)
2933-
2934-Missing data on short circuited requests
2935-----------------------------------------
2936-
2937-Nginx may terminate a request early with (at least):
2938-
2939-* 400 (Bad Request)
2940-* 405 (Not Allowed)
2941-* 408 (Request Timeout)
2942-* 413 (Request Entity Too Large)
2943-* 414 (Request URI Too Large)
2944-* 494 (Request Headers Too Large)
2945-* 499 (Client Closed Request)
2946-* 500 (Internal Server Error)
2947-* 501 (Not Implemented)
2948-
2949-This means that phases that normally run are skipped, such as the rewrite or
2950-access phase. This also means that later phases that are run regardless, e.g.
2951-[log_by_lua](#log_by_lua), will not have access to information that is normally set in those
2952-phases.
2953-
2954-[Back to TOC](#table-of-contents)
2955-
2956-TODO
2957-====
2958-
2959-* cosocket: implement LuaSocket's unconnected UDP API.
2960-* port this module to the "datagram" subsystem of NGINX for implementing general UDP servers instead of HTTP
2961-servers in Lua. For example,
2962-```lua
2963-
2964- datagram {
2965- server {
2966- listen 1953;
2967- handler_by_lua_block {
2968- -- custom Lua code implementing the special UDP server...
2969- }
2970- }
2971- }
2972-```
2973-* shm: implement a "shared queue API" to complement the existing [shared dict](#lua_shared_dict) API.
2974-* cosocket: add support in the context of [init_by_lua*](#init_by_lua).
2975-* cosocket: implement the `bind()` method for stream-typed cosockets.
2976-* cosocket: pool-based backend concurrency level control: implement automatic `connect` queueing when the backend concurrency exceeds its connection pool limit.
2977-* cosocket: review and merge aviramc's [patch](https://github.com/openresty/lua-nginx-module/pull/290) for adding the `bsdrecv` method.
2978-* add new API function `ngx.resp.add_header` to emulate the standard `add_header` config directive.
2979-* review and apply vadim-pavlov's patch for [ngx.location.capture](#ngxlocationcapture)'s `extra_headers` option
2980-* use `ngx_hash_t` to optimize the built-in header look-up process for [ngx.req.set_header](#ngxreqset_header), [ngx.header.HEADER](#ngxheaderheader), and etc.
2981-* add configure options for different strategies of handling the cosocket connection exceeding in the pools.
2982-* add directives to run Lua codes when nginx stops.
2983-* add `ignore_resp_headers`, `ignore_resp_body`, and `ignore_resp` options to [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi) methods, to allow micro performance tuning on the user side.
2984-* add automatic Lua code time slicing support by yielding and resuming the Lua VM actively via Lua's debug hooks.
2985-* add `stat` mode similar to [mod_lua](https://httpd.apache.org/docs/trunk/mod/mod_lua.html).
2986-* cosocket: add client SSL certificate support.
2987-
2988-[Back to TOC](#table-of-contents)
2989-
2990-Changes
2991-=======
2992-
2993-The changes made in every release of this module are listed in the change logs of the OpenResty bundle:
2994-
2995-<http://openresty.org/#Changes>
2996-
2997-[Back to TOC](#table-of-contents)
2998-
2999-Test Suite
3000-==========
3001-
3002-The following dependencies are required to run the test suite:
3003-
3004-* Nginx version >= 1.4.2
3005-
3006-* Perl modules:
3007- * Test::Nginx: <https://github.com/openresty/test-nginx>
3008-
3009-* Nginx modules:
3010- * [ngx_devel_kit](https://github.com/simplresty/ngx_devel_kit)
3011- * [ngx_set_misc](https://github.com/openresty/set-misc-nginx-module)
3012- * [ngx_auth_request](http://mdounin.ru/files/ngx_http_auth_request_module-0.2.tar.gz) (this is not needed if you're using Nginx 1.5.4+.
3013- * [ngx_echo](https://github.com/openresty/echo-nginx-module)
3014- * [ngx_memc](https://github.com/openresty/memc-nginx-module)
3015- * [ngx_srcache](https://github.com/openresty/srcache-nginx-module)
3016- * ngx_lua (i.e., this module)
3017- * [ngx_lua_upstream](https://github.com/openresty/lua-upstream-nginx-module)
3018- * [ngx_headers_more](https://github.com/openresty/headers-more-nginx-module)
3019- * [ngx_drizzle](https://github.com/openresty/drizzle-nginx-module)
3020- * [ngx_rds_json](https://github.com/openresty/rds-json-nginx-module)
3021- * [ngx_coolkit](https://github.com/FRiCKLE/ngx_coolkit)
3022- * [ngx_redis2](https://github.com/openresty/redis2-nginx-module)
3023-
3024-The order in which these modules are added during configuration is important because the position of any filter module in the
3025-filtering chain determines the final output, for example. The correct adding order is shown above.
3026-
3027-* 3rd-party Lua libraries:
3028- * [lua-cjson](http://www.kyne.com.au/~mark/software/lua-cjson.php)
3029-
3030-* Applications:
3031- * mysql: create database 'ngx_test', grant all privileges to user 'ngx_test', password is 'ngx_test'
3032- * memcached: listening on the default port, 11211.
3033- * redis: listening on the default port, 6379.
3034-
3035-See also the [developer build script](https://github.com/openresty/lua-nginx-module/blob/master/util/build.sh) for more details on setting up the testing environment.
3036-
3037-To run the whole test suite in the default testing mode:
3038-
3039- cd /path/to/lua-nginx-module
3040- export PATH=/path/to/your/nginx/sbin:$PATH
3041- prove -I/path/to/test-nginx/lib -r t
3042-
3043-
3044-To run specific test files:
3045-
3046- cd /path/to/lua-nginx-module
3047- export PATH=/path/to/your/nginx/sbin:$PATH
3048- prove -I/path/to/test-nginx/lib t/002-content.t t/003-errors.t
3049-
3050-
3051-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.
3052-
3053-There are also various testing modes based on mockeagain, valgrind, and etc. Refer to the [Test::Nginx documentation](http://search.cpan.org/perldoc?Test::Nginx) 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>.
3054-
3055-[Back to TOC](#table-of-contents)
3056-
3057-Copyright and License
3058-=====================
3059-
3060-This module is licensed under the BSD license.
3061-
3062-Copyright (C) 2009-2017, by Xiaozhe Wang (chaoslawful) <chaoslawful@gmail.com>.
3063-
3064-Copyright (C) 2009-2018, by Yichun "agentzh" Zhang (章亦春) <agentzh@gmail.com>, OpenResty Inc.
3065-
3066-All rights reserved.
3067-
3068-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
3069-
3070-* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
3071-
3072-* 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.
3073-
3074-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.
3075-
3076-[Back to TOC](#table-of-contents)
3077-
3078-See Also
3079-========
3080-
3081-* [ngx_stream_lua_module](https://github.com/openresty/stream-lua-nginx-module#readme) for an official port of this module for the NGINX "stream" subsystem (doing generic downstream TCP communications).
3082-* [lua-resty-memcached](https://github.com/openresty/lua-resty-memcached) library based on ngx_lua cosocket.
3083-* [lua-resty-redis](https://github.com/openresty/lua-resty-redis) library based on ngx_lua cosocket.
3084-* [lua-resty-mysql](https://github.com/openresty/lua-resty-mysql) library based on ngx_lua cosocket.
3085-* [lua-resty-upload](https://github.com/openresty/lua-resty-upload) library based on ngx_lua cosocket.
3086-* [lua-resty-dns](https://github.com/openresty/lua-resty-dns) library based on ngx_lua cosocket.
3087-* [lua-resty-websocket](https://github.com/openresty/lua-resty-websocket) library for both WebSocket server and client, based on ngx_lua cosocket.
3088-* [lua-resty-string](https://github.com/openresty/lua-resty-string) library based on [LuaJIT FFI](http://luajit.org/ext_ffi.html).
3089-* [lua-resty-lock](https://github.com/openresty/lua-resty-lock) library for a nonblocking simple lock API.
3090-* [lua-resty-cookie](https://github.com/cloudflare/lua-resty-cookie) library for HTTP cookie manipulation.
3091-* [Routing requests to different MySQL queries based on URI arguments](http://openresty.org/#RoutingMySQLQueriesBasedOnURIArgs)
3092-* [Dynamic Routing Based on Redis and Lua](http://openresty.org/#DynamicRoutingBasedOnRedis)
3093-* [Using LuaRocks with ngx_lua](http://openresty.org/#UsingLuaRocks)
3094-* [Introduction to ngx_lua](https://github.com/openresty/lua-nginx-module/wiki/Introduction)
3095-* [ngx_devel_kit](https://github.com/simplresty/ngx_devel_kit)
3096-* [echo-nginx-module](http://github.com/openresty/echo-nginx-module)
3097-* [drizzle-nginx-module](http://github.com/openresty/drizzle-nginx-module)
3098-* [postgres-nginx-module](https://github.com/FRiCKLE/ngx_postgres)
3099-* [memc-nginx-module](http://github.com/openresty/memc-nginx-module)
3100-* [The OpenResty bundle](http://openresty.org)
3101-* [Nginx Systemtap Toolkit](https://github.com/openresty/nginx-systemtap-toolkit)
3102-
3103-[Back to TOC](#table-of-contents)
3104-
3105-Directives
3106-==========
3107-
3108-* [lua_capture_error_log](#lua_capture_error_log)
3109-* [lua_use_default_type](#lua_use_default_type)
3110-* [lua_malloc_trim](#lua_malloc_trim)
3111-* [lua_code_cache](#lua_code_cache)
3112-* [lua_regex_cache_max_entries](#lua_regex_cache_max_entries)
3113-* [lua_regex_match_limit](#lua_regex_match_limit)
3114-* [lua_package_path](#lua_package_path)
3115-* [lua_package_cpath](#lua_package_cpath)
3116-* [init_by_lua](#init_by_lua)
3117-* [init_by_lua_block](#init_by_lua_block)
3118-* [init_by_lua_file](#init_by_lua_file)
3119-* [init_worker_by_lua](#init_worker_by_lua)
3120-* [init_worker_by_lua_block](#init_worker_by_lua_block)
3121-* [init_worker_by_lua_file](#init_worker_by_lua_file)
3122-* [set_by_lua](#set_by_lua)
3123-* [set_by_lua_block](#set_by_lua_block)
3124-* [set_by_lua_file](#set_by_lua_file)
3125-* [content_by_lua](#content_by_lua)
3126-* [content_by_lua_block](#content_by_lua_block)
3127-* [content_by_lua_file](#content_by_lua_file)
3128-* [rewrite_by_lua](#rewrite_by_lua)
3129-* [rewrite_by_lua_block](#rewrite_by_lua_block)
3130-* [rewrite_by_lua_file](#rewrite_by_lua_file)
3131-* [access_by_lua](#access_by_lua)
3132-* [access_by_lua_block](#access_by_lua_block)
3133-* [access_by_lua_file](#access_by_lua_file)
3134-* [header_filter_by_lua](#header_filter_by_lua)
3135-* [header_filter_by_lua_block](#header_filter_by_lua_block)
3136-* [header_filter_by_lua_file](#header_filter_by_lua_file)
3137-* [body_filter_by_lua](#body_filter_by_lua)
3138-* [body_filter_by_lua_block](#body_filter_by_lua_block)
3139-* [body_filter_by_lua_file](#body_filter_by_lua_file)
3140-* [log_by_lua](#log_by_lua)
3141-* [log_by_lua_block](#log_by_lua_block)
3142-* [log_by_lua_file](#log_by_lua_file)
3143-* [balancer_by_lua_block](#balancer_by_lua_block)
3144-* [balancer_by_lua_file](#balancer_by_lua_file)
3145-* [lua_need_request_body](#lua_need_request_body)
3146-* [ssl_certificate_by_lua_block](#ssl_certificate_by_lua_block)
3147-* [ssl_certificate_by_lua_file](#ssl_certificate_by_lua_file)
3148-* [ssl_session_fetch_by_lua_block](#ssl_session_fetch_by_lua_block)
3149-* [ssl_session_fetch_by_lua_file](#ssl_session_fetch_by_lua_file)
3150-* [ssl_session_store_by_lua_block](#ssl_session_store_by_lua_block)
3151-* [ssl_session_store_by_lua_file](#ssl_session_store_by_lua_file)
3152-* [lua_shared_dict](#lua_shared_dict)
3153-* [lua_socket_connect_timeout](#lua_socket_connect_timeout)
3154-* [lua_socket_send_timeout](#lua_socket_send_timeout)
3155-* [lua_socket_send_lowat](#lua_socket_send_lowat)
3156-* [lua_socket_read_timeout](#lua_socket_read_timeout)
3157-* [lua_socket_buffer_size](#lua_socket_buffer_size)
3158-* [lua_socket_pool_size](#lua_socket_pool_size)
3159-* [lua_socket_keepalive_timeout](#lua_socket_keepalive_timeout)
3160-* [lua_socket_log_errors](#lua_socket_log_errors)
3161-* [lua_ssl_ciphers](#lua_ssl_ciphers)
3162-* [lua_ssl_crl](#lua_ssl_crl)
3163-* [lua_ssl_protocols](#lua_ssl_protocols)
3164-* [lua_ssl_trusted_certificate](#lua_ssl_trusted_certificate)
3165-* [lua_ssl_verify_depth](#lua_ssl_verify_depth)
3166-* [lua_http10_buffering](#lua_http10_buffering)
3167-* [rewrite_by_lua_no_postpone](#rewrite_by_lua_no_postpone)
3168-* [access_by_lua_no_postpone](#access_by_lua_no_postpone)
3169-* [lua_transform_underscores_in_response_headers](#lua_transform_underscores_in_response_headers)
3170-* [lua_check_client_abort](#lua_check_client_abort)
3171-* [lua_max_pending_timers](#lua_max_pending_timers)
3172-* [lua_max_running_timers](#lua_max_running_timers)
3173-
3174-
3175-The basic building blocks of scripting Nginx with Lua are directives. Directives are used to specify when the user Lua code is run and
3176-how the result will be used. Below is a diagram showing the order in which directives are executed.
3177-
3178-![Lua Nginx Modules Directives](https://cloud.githubusercontent.com/assets/2137369/15272097/77d1c09e-1a37-11e6-97ef-d9767035fc3e.png)
3179-
3180-[Back to TOC](#table-of-contents)
3181-
3182-lua_capture_error_log
3183----------------------
3184-**syntax:** *lua_capture_error_log size*
3185-
3186-**default:** *none*
3187-
3188-**context:** *http*
3189-
3190-Enables a buffer of the specified `size` for capturing all the nginx error log message data (not just those produced
3191-by this module or the nginx http subsystem, but everything) without touching files or disks.
3192-
3193-You can use units like `k` and `m` in the `size` value, as in
3194-
3195-```nginx
3196-
3197- lua_capture_error_log 100k;
3198-```
3199-
3200-As a rule of thumb, a 4KB buffer can usually hold about 20 typical error log messages. So do the maths!
3201-
3202-This buffer never grows. If it is full, new error log messages will replace the oldest ones in the buffer.
3203-
3204-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).
3205-
3206-You can read the messages in the buffer on the Lua land via the
3207-[get_logs()](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/errlog.md#get_logs)
3208-function of the
3209-[ngx.errlog](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/errlog.md#readme)
3210-module of the [lua-resty-core](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/errlog.md#readme)
3211-library. This Lua API function will return the captured error log messages and
3212-also remove these already read from the global capturing buffer, making room
3213-for any new error log data. For this reason, the user should not configure this
3214-buffer to be too big if the user read the buffered error log data fast enough.
3215-
3216-Note that the log level specified in the standard [error_log](http://nginx.org/r/error_log) directive
3217-*does* have effect on this capturing facility. It only captures log
3218-messages of a level no lower than the specified log level in the [error_log](http://nginx.org/r/error_log) directive.
3219-The user can still choose to set an even higher filtering log level on the fly via the Lua API function
3220-[errlog.set_filter_level](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/errlog.md#set_filter_level).
3221-So it is more flexible than the static [error_log](http://nginx.org/r/error_log) directive.
3222-
3223-It is worth noting that there is no way to capture the debugging logs
3224-without building OpenResty or NGINX with the `./configure`
3225-option `--with-debug`. And enabling debugging logs is
3226-strongly discouraged in production builds due to high overhead.
3227-
3228-This directive was first introduced in the `v0.10.9` release.
3229-
3230-[Back to TOC](#directives)
3231-
3232-lua_use_default_type
3233---------------------
3234-**syntax:** *lua_use_default_type on | off*
3235-
3236-**default:** *lua_use_default_type on*
3237-
3238-**context:** *http, server, location, location if*
3239-
3240-Specifies whether to use the MIME type specified by the [default_type](http://nginx.org/en/docs/http/ngx_http_core_module.html#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.
3241-
3242-This directive is turned on by default.
3243-
3244-This directive was first introduced in the `v0.9.1` release.
3245-
3246-[Back to TOC](#directives)
3247-
3248-lua_malloc_trim
3249----------------
3250-**syntax:** *lua_malloc_trim &lt;request-count&gt;*
3251-
3252-**default:** *lua_malloc_trim 1000*
3253-
3254-**context:** *http*
3255-
3256-Asks the underlying `libc` runtime library to release its cached free memory back to the operating system every
3257-`N` requests processed by the NGINX core. By default, `N` is 1000. You can configure the request count
3258-by using your own numbers. Smaller numbers mean more frequent releases, which may introduce higher CPU time consumption and
3259-smaller memory footprint while larger numbers usually lead to less CPU time overhead and relatively larger memory footprint.
3260-Just tune the number for your own use cases.
3261-
3262-Configuring the argument to `0` essentially turns off the periodical memory trimming altogether.
3263-
3264-```nginx
3265-
3266- lua_malloc_trim 0; # turn off trimming completely
3267-```
3268-
3269-The current implementation uses an NGINX log phase handler to do the request counting. So the appearance of the
3270-[log_subrequest on](http://nginx.org/en/docs/http/ngx_http_core_module.html#log_subrequest) directives in `nginx.conf`
3271-may make the counting faster when subrequests are involved. By default, only "main requests" count.
3272-
3273-Note that this directive does *not* affect the memory allocated by LuaJIT's own allocator based on the `mmap`
3274-system call.
3275-
3276-This directive was first introduced in the `v0.10.7` release.
3277-
3278-[Back to TOC](#directives)
3279-
3280-lua_code_cache
3281---------------
3282-**syntax:** *lua_code_cache on | off*
3283-
3284-**default:** *lua_code_cache on*
3285-
3286-**context:** *http, server, location, location if*
3287-
3288-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
3289-[content_by_lua_file](#content_by_lua_file)) and Lua modules.
3290-
3291-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),
3292-[content_by_lua_file](#content_by_lua_file), [access_by_lua_file](#access_by_lua_file),
3293-and etc will not be cached
3294-and all Lua modules used will be loaded from scratch. With this in place, developers can adopt an edit-and-refresh approach.
3295-
3296-Please note however, that Lua code written inlined within nginx.conf
3297-such as those specified by [set_by_lua](#set_by_lua), [content_by_lua](#content_by_lua),
3298-[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`
3299-file and the only way is to reload the config file
3300-by sending a `HUP` signal or just to restart Nginx.
3301-
3302-Even when the code cache is enabled, Lua files which are loaded by `dofile` or `loadfile`
3303-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)
3304-or [init_by_lua_file](#init-by_lua_file) directives to load all such files or just make these Lua files true Lua modules
3305-and load them via `require`.
3306-
3307-The ngx_lua module does not support the `stat` mode available with the
3308-Apache `mod_lua` module (yet).
3309-
3310-Disabling the Lua code cache is strongly
3311-discouraged for production use and should only be used during
3312-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.
3313-
3314-[Back to TOC](#directives)
3315-
3316-lua_regex_cache_max_entries
3317----------------------------
3318-**syntax:** *lua_regex_cache_max_entries &lt;num&gt;*
3319-
3320-**default:** *lua_regex_cache_max_entries 1024*
3321-
3322-**context:** *http*
3323-
3324-Specifies the maximum number of entries allowed in the worker process level compiled regex cache.
3325-
3326-The regular expressions used in [ngx.re.match](#ngxrematch), [ngx.re.gmatch](#ngxregmatch), [ngx.re.sub](#ngxresub), and [ngx.re.gsub](#ngxregsub) will be cached within this cache if the regex option `o` (i.e., compile-once flag) is specified.
3327-
3328-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:
3329-
3330-
3331- 2011/08/27 23:18:26 [warn] 31997#0: *1 lua exceeding regex cache max entries (1024), ...
3332-
3333-
3334-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.
3335-
3336-Do not activate the `o` option for regular expressions (and/or `replace` string arguments for [ngx.re.sub](#ngxresub) and [ngx.re.gsub](#ngxregsub)) that are generated *on the fly* and give rise to infinite variations to avoid hitting the specified limit.
3337-
3338-[Back to TOC](#directives)
3339-
3340-lua_regex_match_limit
3341----------------------
3342-**syntax:** *lua_regex_match_limit &lt;num&gt;*
3343-
3344-**default:** *lua_regex_match_limit 0*
3345-
3346-**context:** *http*
3347-
3348-Specifies the "match limit" used by the PCRE library when executing the [ngx.re API](#ngxrematch). To quote the PCRE manpage, "the limit ... has the effect of limiting the amount of backtracking that can take place."
3349-
3350-When the limit is hit, the error string "pcre_exec() failed: -8" will be returned by the [ngx.re API](#ngxrematch) functions on the Lua land.
3351-
3352-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.
3353-
3354-This directive was first introduced in the `v0.8.5` release.
3355-
3356-[Back to TOC](#directives)
3357-
3358-lua_package_path
3359-----------------
3360-
3361-**syntax:** *lua_package_path &lt;lua-style-path-str&gt;*
3362-
3363-**default:** *The content of LUA_PATH environment variable or Lua's compiled-in defaults.*
3364-
3365-**context:** *http*
3366-
3367-Sets the Lua module search path used by scripts specified by [set_by_lua](#set_by_lua),
3368-[content_by_lua](#content_by_lua) and others. The path string is in standard Lua path form, and `;;`
3369-can be used to stand for the original search paths.
3370-
3371-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.
3372-
3373-[Back to TOC](#directives)
3374-
3375-lua_package_cpath
3376------------------
3377-
3378-**syntax:** *lua_package_cpath &lt;lua-style-cpath-str&gt;*
3379-
3380-**default:** *The content of LUA_CPATH environment variable or Lua's compiled-in defaults.*
3381-
3382-**context:** *http*
3383-
3384-Sets the Lua C-module search path used by scripts specified by [set_by_lua](#set_by_lua),
3385-[content_by_lua](#content_by_lua) and others. The cpath string is in standard Lua cpath form, and `;;`
3386-can be used to stand for the original cpath.
3387-
3388-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.
3389-
3390-[Back to TOC](#directives)
3391-
3392-init_by_lua
3393------------
3394-
3395-**syntax:** *init_by_lua &lt;lua-script-str&gt;*
3396-
3397-**context:** *http*
3398-
3399-**phase:** *loading-config*
3400-
3401-**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.
3402-
3403-Runs the Lua code specified by the argument `<lua-script-str>` on the global Lua VM level when the Nginx master process (if any) is loading the Nginx config file.
3404-
3405-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.
3406-
3407-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:
3408-
3409-```nginx
3410-
3411- # this runs before forking out nginx worker processes:
3412- init_by_lua_block { require "cjson" }
3413-
3414- server {
3415- location = /api {
3416- content_by_lua_block {
3417- -- the following require() will just return
3418- -- the alrady loaded module from package.loaded:
3419- ngx.say(require "cjson".encode{dog = 5, cat = 6})
3420- }
3421- }
3422- }
3423-```
3424-
3425-You can also initialize the [lua_shared_dict](#lua_shared_dict) shm storage at this phase. Here is an example for this:
3426-
3427-```nginx
3428-
3429- lua_shared_dict dogs 1m;
3430-
3431- init_by_lua_block {
3432- local dogs = ngx.shared.dogs;
3433- dogs:set("Tom", 56)
3434- }
3435-
3436- server {
3437- location = /api {
3438- content_by_lua_block {
3439- local dogs = ngx.shared.dogs;
3440- ngx.say(dogs:get("Tom"))
3441- }
3442- }
3443- }
3444-```
3445-
3446-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.
3447-
3448-Because the Lua code in this context runs before Nginx forks its worker processes (if any), data or code loaded here will enjoy the [Copy-on-write (COW)](http://en.wikipedia.org/wiki/Copy-on-write) feature provided by many operating systems among all the worker processes, thus saving a lot of memory.
3449-
3450-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 [Lua module](http://www.lua.org/manual/5.1/manual.html#5.3) files (but do not use the standard Lua function [module()](http://www.lua.org/manual/5.1/manual.html#pdf-module) to define Lua modules because it pollutes the global namespace as well) and call [require()](http://www.lua.org/manual/5.1/manual.html#pdf-require) to load your own module files in `init_by_lua` or other contexts ([require()](http://www.lua.org/manual/5.1/manual.html#pdf-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).
3451-
3452-Only a small set of the [Nginx API for Lua](#nginx-api-for-lua) is supported in this context:
3453-
3454-* Logging APIs: [ngx.log](#ngxlog) and [print](#print),
3455-* Shared Dictionary API: [ngx.shared.DICT](#ngxshareddict).
3456-
3457-More Nginx APIs for Lua may be supported in this context upon future user requests.
3458-
3459-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.
3460-
3461-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.
3462-
3463-This directive was first introduced in the `v0.5.5` release.
3464-
3465-[Back to TOC](#directives)
3466-
3467-init_by_lua_block
3468------------------
3469-
3470-**syntax:** *init_by_lua_block { lua-script }*
3471-
3472-**context:** *http*
3473-
3474-**phase:** *loading-config*
3475-
3476-Similar to the [init_by_lua](#init_by_lua) directive except that this directive inlines
3477-the Lua source directly
3478-inside a pair of curly braces (`{}`) instead of in an NGINX string literal (which requires
3479-special character escaping).
3480-
3481-For instance,
3482-
3483-```nginx
3484-
3485- init_by_lua_block {
3486- print("I need no extra escaping here, for example: \r\nblah")
3487- }
3488-```
3489-
3490-This directive was first introduced in the `v0.9.17` release.
3491-
3492-[Back to TOC](#directives)
3493-
3494-init_by_lua_file
3495-----------------
3496-
3497-**syntax:** *init_by_lua_file &lt;path-to-lua-script-file&gt;*
3498-
3499-**context:** *http*
3500-
3501-**phase:** *loading-config*
3502-
3503-Equivalent to [init_by_lua](#init_by_lua), except that the file specified by `<path-to-lua-script-file>` contains the Lua code or [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed.
3504-
3505-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.
3506-
3507-This directive was first introduced in the `v0.5.5` release.
3508-
3509-[Back to TOC](#directives)
3510-
3511-init_worker_by_lua
3512-------------------
3513-
3514-**syntax:** *init_worker_by_lua &lt;lua-script-str&gt;*
3515-
3516-**context:** *http*
3517-
3518-**phase:** *starting-worker*
3519-
3520-**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.
3521-
3522-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).
3523-
3524-This hook is often used to create per-worker reoccurring timers (via the [ngx.timer.at](#ngxtimerat) Lua API), either for backend health-check or other timed routine work. Below is an example,
3525-
3526-```nginx
3527-
3528- init_worker_by_lua '
3529- local delay = 3 -- in seconds
3530- local new_timer = ngx.timer.at
3531- local log = ngx.log
3532- local ERR = ngx.ERR
3533- local check
3534-
3535- check = function(premature)
3536- if not premature then
3537- -- do the health check or other routine work
3538- local ok, err = new_timer(delay, check)
3539- if not ok then
3540- log(ERR, "failed to create timer: ", err)
3541- return
3542- end
3543- end
3544- end
3545-
3546- local hdl, err = new_timer(delay, check)
3547- if not hdl then
3548- log(ERR, "failed to create timer: ", err)
3549- return
3550- end
3551- ';
3552-```
3553-
3554-This directive was first introduced in the `v0.9.5` release.
3555-
3556-This hook no longer runs in the cache manager and cache loader processes since the `v0.10.12` release.
3557-
3558-[Back to TOC](#directives)
3559-
3560-init_worker_by_lua_block
3561-------------------------
3562-
3563-**syntax:** *init_worker_by_lua_block { lua-script }*
3564-
3565-**context:** *http*
3566-
3567-**phase:** *starting-worker*
3568-
3569-Similar to the [init_worker_by_lua](#init_worker_by_lua) directive except that this directive inlines
3570-the Lua source directly
3571-inside a pair of curly braces (`{}`) instead of in an NGINX string literal (which requires
3572-special character escaping).
3573-
3574-For instance,
3575-
3576-```nginx
3577-
3578- init_worker_by_lua_block {
3579- print("I need no extra escaping here, for example: \r\nblah")
3580- }
3581-```
3582-
3583-This directive was first introduced in the `v0.9.17` release.
3584-
3585-This hook no longer runs in the cache manager and cache loader processes since the `v0.10.12` release.
3586-
3587-[Back to TOC](#directives)
3588-
3589-init_worker_by_lua_file
3590------------------------
3591-
3592-**syntax:** *init_worker_by_lua_file &lt;lua-file-path&gt;*
3593-
3594-**context:** *http*
3595-
3596-**phase:** *starting-worker*
3597-
3598-Similar to [init_worker_by_lua](#init_worker_by_lua), but accepts the file path to a Lua source file or Lua bytecode file.
3599-
3600-This directive was first introduced in the `v0.9.5` release.
3601-
3602-This hook no longer runs in the cache manager and cache loader processes since the `v0.10.12` release.
3603-
3604-[Back to TOC](#directives)
3605-
3606-set_by_lua
3607-----------
3608-
3609-**syntax:** *set_by_lua $res &lt;lua-script-str&gt; [$arg1 $arg2 ...]*
3610-
3611-**context:** *server, server if, location, location if*
3612-
3613-**phase:** *rewrite*
3614-
3615-**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.
3616-
3617-Executes code specified in `<lua-script-str>` with optional input arguments `$arg1 $arg2 ...`, and returns string output to `$res`.
3618-The code in `<lua-script-str>` can make [API calls](#nginx-api-for-lua) and can retrieve input arguments from the `ngx.arg` table (index starts from `1` and increases sequentially).
3619-
3620-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.
3621-
3622-This directive is implemented by injecting custom commands into the standard [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html)'s command list. Because [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html) does not support nonblocking I/O in its commands, Lua APIs requiring yielding the current Lua "light thread" cannot work in this directive.
3623-
3624-At least the following API functions are currently disabled within the context of `set_by_lua`:
3625-
3626-* Output API functions (e.g., [ngx.say](#ngxsay) and [ngx.send_headers](#ngxsend_headers))
3627-* Control API functions (e.g., [ngx.exit](#ngxexit))
3628-* Subrequest API functions (e.g., [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi))
3629-* Cosocket API functions (e.g., [ngx.socket.tcp](#ngxsockettcp) and [ngx.req.socket](#ngxreqsocket)).
3630-* Sleeping API function [ngx.sleep](#ngxsleep).
3631-
3632-In addition, note that this directive can only write out a value to a single Nginx variable at
3633-a time. However, a workaround is possible using the [ngx.var.VARIABLE](#ngxvarvariable) interface.
3634-
3635-```nginx
3636-
3637- location /foo {
3638- set $diff ''; # we have to predefine the $diff variable here
3639-
3640- set_by_lua $sum '
3641- local a = 32
3642- local b = 56
3643-
3644- ngx.var.diff = a - b; -- write to $diff directly
3645- return a + b; -- return the $sum value normally
3646- ';
3647-
3648- echo "sum = $sum, diff = $diff";
3649- }
3650-```
3651-
3652-This directive can be freely mixed with all directives of the [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html), [set-misc-nginx-module](http://github.com/openresty/set-misc-nginx-module), and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module) modules. All of these directives will run in the same order as they appear in the config file.
3653-
3654-```nginx
3655-
3656- set $foo 32;
3657- set_by_lua $bar 'return tonumber(ngx.var.foo) + 1';
3658- set $baz "bar: $bar"; # $baz == "bar: 33"
3659-```
3660-
3661-As from the `v0.5.0rc29` release, Nginx variable interpolation is disabled in the `<lua-script-str>` argument of this directive and therefore, the dollar sign character (`$`) can be used directly.
3662-
3663-This directive requires the [ngx_devel_kit](https://github.com/simplresty/ngx_devel_kit) module.
3664-
3665-[Back to TOC](#directives)
3666-
3667-set_by_lua_block
3668-----------------
3669-
3670-**syntax:** *set_by_lua_block $res { lua-script }*
3671-
3672-**context:** *server, server if, location, location if*
3673-
3674-**phase:** *rewrite*
3675-
3676-Similar to the [set_by_lua](#set_by_lua) directive except that
3677-
3678-1. this directive inlines the Lua source directly
3679-inside a pair of curly braces (`{}`) instead of in an NGINX string literal (which requires
3680-special character escaping), and
3681-1. this directive does not support extra arguments after the Lua script as in [set_by_lua](#set_by_lua).
3682-
3683-For example,
3684-
3685-```nginx
3686-
3687- set_by_lua_block $res { return 32 + math.cos(32) }
3688- # $res now has the value "32.834223360507" or alike.
3689-```
3690-
3691-No special escaping is required in the Lua code block.
3692-
3693-This directive was first introduced in the `v0.9.17` release.
3694-
3695-[Back to TOC](#directives)
3696-
3697-set_by_lua_file
3698----------------
3699-**syntax:** *set_by_lua_file $res &lt;path-to-lua-script-file&gt; [$arg1 $arg2 ...]*
3700-
3701-**context:** *server, server if, location, location if*
3702-
3703-**phase:** *rewrite*
3704-
3705-Equivalent to [set_by_lua](#set_by_lua), except that the file specified by `<path-to-lua-script-file>` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed.
3706-
3707-Nginx variable interpolation is supported in the `<path-to-lua-script-file>` argument string of this directive. But special care must be taken for injection attacks.
3708-
3709-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.
3710-
3711-When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached
3712-and the Nginx config must be reloaded each time the Lua source file is modified.
3713-The Lua code cache can be temporarily disabled during development by
3714-switching [lua_code_cache](#lua_code_cache) `off` in `nginx.conf` to avoid reloading Nginx.
3715-
3716-This directive requires the [ngx_devel_kit](https://github.com/simplresty/ngx_devel_kit) module.
3717-
3718-[Back to TOC](#directives)
3719-
3720-content_by_lua
3721---------------
3722-
3723-**syntax:** *content_by_lua &lt;lua-script-str&gt;*
3724-
3725-**context:** *location, location if*
3726-
3727-**phase:** *content*
3728-
3729-**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.
3730-
3731-Acts as a "content handler" and executes Lua code string specified in `<lua-script-str>` for every request.
3732-The Lua code may make [API calls](#nginx-api-for-lua) and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox).
3733-
3734-Do not use this directive and other content handler directives in the same location. For example, this directive and the [proxy_pass](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass) directive should not be used in the same location.
3735-
3736-[Back to TOC](#directives)
3737-
3738-content_by_lua_block
3739---------------------
3740-
3741-**syntax:** *content_by_lua_block { lua-script }*
3742-
3743-**context:** *location, location if*
3744-
3745-**phase:** *content*
3746-
3747-Similar to the [content_by_lua](#content_by_lua) directive except that this directive inlines
3748-the Lua source directly
3749-inside a pair of curly braces (`{}`) instead of in an NGINX string literal (which requires
3750-special character escaping).
3751-
3752-For instance,
3753-
3754-```nginx
3755-
3756- content_by_lua_block {
3757- ngx.say("I need no extra escaping here, for example: \r\nblah")
3758- }
3759-```
3760-
3761-This directive was first introduced in the `v0.9.17` release.
3762-
3763-[Back to TOC](#directives)
3764-
3765-content_by_lua_file
3766--------------------
3767-
3768-**syntax:** *content_by_lua_file &lt;path-to-lua-script-file&gt;*
3769-
3770-**context:** *location, location if*
3771-
3772-**phase:** *content*
3773-
3774-Equivalent to [content_by_lua](#content_by_lua), except that the file specified by `<path-to-lua-script-file>` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed.
3775-
3776-Nginx variables can be used in the `<path-to-lua-script-file>` string to provide flexibility. This however carries some risks and is not ordinarily recommended.
3777-
3778-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.
3779-
3780-When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached
3781-and the Nginx config must be reloaded each time the Lua source file is modified.
3782-The Lua code cache can be temporarily disabled during development by
3783-switching [lua_code_cache](#lua_code_cache) `off` in `nginx.conf` to avoid reloading Nginx.
3784-
3785-Nginx variables are supported in the file path for dynamic dispatch, for example:
3786-
3787-```nginx
3788-
3789- # CAUTION: contents in nginx var must be carefully filtered,
3790- # otherwise there'll be great security risk!
3791- location ~ ^/app/([-_a-zA-Z0-9/]+) {
3792- set $path $1;
3793- content_by_lua_file /path/to/lua/app/root/$path.lua;
3794- }
3795-```
3796-
3797-But be very careful about malicious user inputs and always carefully validate or filter out the user-supplied path components.
3798-
3799-[Back to TOC](#directives)
3800-
3801-rewrite_by_lua
3802---------------
3803-
3804-**syntax:** *rewrite_by_lua &lt;lua-script-str&gt;*
3805-
3806-**context:** *http, server, location, location if*
3807-
3808-**phase:** *rewrite tail*
3809-
3810-**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.
3811-
3812-Acts as a rewrite phase handler and executes Lua code string specified in `<lua-script-str>` for every request.
3813-The Lua code may make [API calls](#nginx-api-for-lua) and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox).
3814-
3815-Note that this handler always runs *after* the standard [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html). So the following will work as expected:
3816-
3817-```nginx
3818-
3819- location /foo {
3820- set $a 12; # create and initialize $a
3821- set $b ""; # create and initialize $b
3822- rewrite_by_lua 'ngx.var.b = tonumber(ngx.var.a) + 1';
3823- echo "res = $b";
3824- }
3825-```
3826-
3827-because `set $a 12` and `set $b ""` run *before* [rewrite_by_lua](#rewrite_by_lua).
3828-
3829-On the other hand, the following will not work as expected:
3830-
3831-```nginx
3832-
3833- ? location /foo {
3834- ? set $a 12; # create and initialize $a
3835- ? set $b ''; # create and initialize $b
3836- ? rewrite_by_lua 'ngx.var.b = tonumber(ngx.var.a) + 1';
3837- ? if ($b = '13') {
3838- ? rewrite ^ /bar redirect;
3839- ? break;
3840- ? }
3841- ?
3842- ? echo "res = $b";
3843- ? }
3844-```
3845-
3846-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.
3847-
3848-The right way of doing this is as follows:
3849-
3850-```nginx
3851-
3852- location /foo {
3853- set $a 12; # create and initialize $a
3854- set $b ''; # create and initialize $b
3855- rewrite_by_lua '
3856- ngx.var.b = tonumber(ngx.var.a) + 1
3857- if tonumber(ngx.var.b) == 13 then
3858- return ngx.redirect("/bar");
3859- end
3860- ';
3861-
3862- echo "res = $b";
3863- }
3864-```
3865-
3866-Note that the [ngx_eval](http://www.grid.net.ru/nginx/eval.en.html) module can be approximated by using [rewrite_by_lua](#rewrite_by_lua). For example,
3867-
3868-```nginx
3869-
3870- location / {
3871- eval $res {
3872- proxy_pass http://foo.com/check-spam;
3873- }
3874-
3875- if ($res = 'spam') {
3876- rewrite ^ /terms-of-use.html redirect;
3877- }
3878-
3879- fastcgi_pass ...;
3880- }
3881-```
3882-
3883-can be implemented in ngx_lua as:
3884-
3885-```nginx
3886-
3887- location = /check-spam {
3888- internal;
3889- proxy_pass http://foo.com/check-spam;
3890- }
3891-
3892- location / {
3893- rewrite_by_lua '
3894- local res = ngx.location.capture("/check-spam")
3895- if res.body == "spam" then
3896- return ngx.redirect("/terms-of-use.html")
3897- end
3898- ';
3899-
3900- fastcgi_pass ...;
3901- }
3902-```
3903-
3904-Just as any other rewrite phase handlers, [rewrite_by_lua](#rewrite_by_lua) also runs in subrequests.
3905-
3906-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](#ngxexit) 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.
3907-
3908-If the [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html)'s [rewrite](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#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,
3909-
3910-```nginx
3911-
3912- location /foo {
3913- rewrite ^ /bar;
3914- rewrite_by_lua 'ngx.exit(503)';
3915- }
3916- location /bar {
3917- ...
3918- }
3919-```
3920-
3921-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.
3922-
3923-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.
3924-
3925-[Back to TOC](#directives)
3926-
3927-rewrite_by_lua_block
3928---------------------
3929-
3930-**syntax:** *rewrite_by_lua_block { lua-script }*
3931-
3932-**context:** *http, server, location, location if*
3933-
3934-**phase:** *rewrite tail*
3935-
3936-Similar to the [rewrite_by_lua](#rewrite_by_lua) directive except that this directive inlines
3937-the Lua source directly
3938-inside a pair of curly braces (`{}`) instead of in an NGINX string literal (which requires
3939-special character escaping).
3940-
3941-For instance,
3942-
3943-```nginx
3944-
3945- rewrite_by_lua_block {
3946- do_something("hello, world!\nhiya\n")
3947- }
3948-```
3949-
3950-This directive was first introduced in the `v0.9.17` release.
3951-
3952-[Back to TOC](#directives)
3953-
3954-rewrite_by_lua_file
3955--------------------
3956-
3957-**syntax:** *rewrite_by_lua_file &lt;path-to-lua-script-file&gt;*
3958-
3959-**context:** *http, server, location, location if*
3960-
3961-**phase:** *rewrite tail*
3962-
3963-Equivalent to [rewrite_by_lua](#rewrite_by_lua), except that the file specified by `<path-to-lua-script-file>` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed.
3964-
3965-Nginx variables can be used in the `<path-to-lua-script-file>` string to provide flexibility. This however carries some risks and is not ordinarily recommended.
3966-
3967-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.
3968-
3969-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.
3970-
3971-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.
3972-
3973-Nginx variables are supported in the file path for dynamic dispatch just as in [content_by_lua_file](#content_by_lua_file).
3974-
3975-[Back to TOC](#directives)
3976-
3977-access_by_lua
3978--------------
3979-
3980-**syntax:** *access_by_lua &lt;lua-script-str&gt;*
3981-
3982-**context:** *http, server, location, location if*
3983-
3984-**phase:** *access tail*
3985-
3986-**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.
3987-
3988-Acts as an access phase handler and executes Lua code string specified in `<lua-script-str>` for every request.
3989-The Lua code may make [API calls](#nginx-api-for-lua) and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox).
3990-
3991-Note that this handler always runs *after* the standard [ngx_http_access_module](http://nginx.org/en/docs/http/ngx_http_access_module.html). So the following will work as expected:
3992-
3993-```nginx
3994-
3995- location / {
3996- deny 192.168.1.1;
3997- allow 192.168.1.0/24;
3998- allow 10.1.1.0/16;
3999- deny all;
4000-
4001- access_by_lua '
4002- local res = ngx.location.capture("/mysql", { ... })
4003- ...
4004- ';
4005-
4006- # proxy_pass/fastcgi_pass/...
4007- }
4008-```
4009-
4010-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).
4011-
4012-Note that the [ngx_auth_request](http://mdounin.ru/hg/ngx_http_auth_request_module/) module can be approximated by using [access_by_lua](#access_by_lua):
4013-
4014-```nginx
4015-
4016- location / {
4017- auth_request /auth;
4018-
4019- # proxy_pass/fastcgi_pass/postgres_pass/...
4020- }
4021-```
4022-
4023-can be implemented in ngx_lua as:
4024-
4025-```nginx
4026-
4027- location / {
4028- access_by_lua '
4029- local res = ngx.location.capture("/auth")
4030-
4031- if res.status == ngx.HTTP_OK then
4032- return
4033- end
4034-
4035- if res.status == ngx.HTTP_FORBIDDEN then
4036- ngx.exit(res.status)
4037- end
4038-
4039- ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
4040- ';
4041-
4042- # proxy_pass/fastcgi_pass/postgres_pass/...
4043- }
4044-```
4045-
4046-As with other access phase handlers, [access_by_lua](#access_by_lua) will *not* run in subrequests.
4047-
4048-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](#ngxexit) 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.
4049-
4050-Starting from the `v0.9.20` release, you can use the [access_by_lua_no_postpone](#access_by_lua_no_postpone)
4051-directive to control when to run this handler inside the "access" request-processing phase
4052-of NGINX.
4053-
4054-[Back to TOC](#directives)
4055-
4056-access_by_lua_block
4057--------------------
4058-
4059-**syntax:** *access_by_lua_block { lua-script }*
4060-
4061-**context:** *http, server, location, location if*
4062-
4063-**phase:** *access tail*
4064-
4065-Similar to the [access_by_lua](#access_by_lua) directive except that this directive inlines
4066-the Lua source directly
4067-inside a pair of curly braces (`{}`) instead of in an NGINX string literal (which requires
4068-special character escaping).
4069-
4070-For instance,
4071-
4072-```nginx
4073-
4074- access_by_lua_block {
4075- do_something("hello, world!\nhiya\n")
4076- }
4077-```
4078-
4079-This directive was first introduced in the `v0.9.17` release.
4080-
4081-[Back to TOC](#directives)
4082-
4083-access_by_lua_file
4084-------------------
4085-
4086-**syntax:** *access_by_lua_file &lt;path-to-lua-script-file&gt;*
4087-
4088-**context:** *http, server, location, location if*
4089-
4090-**phase:** *access tail*
4091-
4092-Equivalent to [access_by_lua](#access_by_lua), except that the file specified by `<path-to-lua-script-file>` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed.
4093-
4094-Nginx variables can be used in the `<path-to-lua-script-file>` string to provide flexibility. This however carries some risks and is not ordinarily recommended.
4095-
4096-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.
4097-
4098-When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached
4099-and the Nginx config must be reloaded each time the Lua source file is modified.
4100-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.
4101-
4102-Nginx variables are supported in the file path for dynamic dispatch just as in [content_by_lua_file](#content_by_lua_file).
4103-
4104-[Back to TOC](#directives)
4105-
4106-header_filter_by_lua
4107---------------------
4108-
4109-**syntax:** *header_filter_by_lua &lt;lua-script-str&gt;*
4110-
4111-**context:** *http, server, location, location if*
4112-
4113-**phase:** *output-header-filter*
4114-
4115-**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.
4116-
4117-Uses Lua code specified in `<lua-script-str>` to define an output header filter.
4118-
4119-Note that the following API functions are currently disabled within this context:
4120-
4121-* Output API functions (e.g., [ngx.say](#ngxsay) and [ngx.send_headers](#ngxsend_headers))
4122-* Control API functions (e.g., [ngx.redirect](#ngxredirect) and [ngx.exec](#ngxexec))
4123-* Subrequest API functions (e.g., [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi))
4124-* Cosocket API functions (e.g., [ngx.socket.tcp](#ngxsockettcp) and [ngx.req.socket](#ngxreqsocket)).
4125-
4126-Here is an example of overriding a response header (or adding one if absent) in our Lua header filter:
4127-
4128-```nginx
4129-
4130- location / {
4131- proxy_pass http://mybackend;
4132- header_filter_by_lua 'ngx.header.Foo = "blah"';
4133- }
4134-```
4135-
4136-This directive was first introduced in the `v0.2.1rc20` release.
4137-
4138-[Back to TOC](#directives)
4139-
4140-header_filter_by_lua_block
4141---------------------------
4142-
4143-**syntax:** *header_filter_by_lua_block { lua-script }*
4144-
4145-**context:** *http, server, location, location if*
4146-
4147-**phase:** *output-header-filter*
4148-
4149-Similar to the [header_filter_by_lua](#header_filter_by_lua) directive except that this directive inlines
4150-the Lua source directly
4151-inside a pair of curly braces (`{}`) instead of in an NGINX string literal (which requires
4152-special character escaping).
4153-
4154-For instance,
4155-
4156-```nginx
4157-
4158- header_filter_by_lua_block {
4159- ngx.header["content-length"] = nil
4160- }
4161-```
4162-
4163-This directive was first introduced in the `v0.9.17` release.
4164-
4165-[Back to TOC](#directives)
4166-
4167-header_filter_by_lua_file
4168--------------------------
4169-
4170-**syntax:** *header_filter_by_lua_file &lt;path-to-lua-script-file&gt;*
4171-
4172-**context:** *http, server, location, location if*
4173-
4174-**phase:** *output-header-filter*
4175-
4176-Equivalent to [header_filter_by_lua](#header_filter_by_lua), except that the file specified by `<path-to-lua-script-file>` contains the Lua code, or as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed.
4177-
4178-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.
4179-
4180-This directive was first introduced in the `v0.2.1rc20` release.
4181-
4182-[Back to TOC](#directives)
4183-
4184-body_filter_by_lua
4185-------------------
4186-
4187-**syntax:** *body_filter_by_lua &lt;lua-script-str&gt;*
4188-
4189-**context:** *http, server, location, location if*
4190-
4191-**phase:** *output-body-filter*
4192-
4193-**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.
4194-
4195-Uses Lua code specified in `<lua-script-str>` to define an output body filter.
4196-
4197-The input data chunk is passed via [ngx.arg](#ngxarg)\[1\] (as a Lua string value) and the "eof" flag indicating the end of the response body data stream is passed via [ngx.arg](#ngxarg)\[2\] (as a Lua boolean value).
4198-
4199-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.)
4200-
4201-The output data stream can be aborted immediately by running the following Lua statement:
4202-
4203-```lua
4204-
4205- return ngx.ERROR
4206-```
4207-
4208-This will truncate the response body and usually result in incomplete and also invalid responses.
4209-
4210-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](#ngxarg)\[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:
4211-
4212-```nginx
4213-
4214- location / {
4215- proxy_pass http://mybackend;
4216- body_filter_by_lua 'ngx.arg[1] = string.upper(ngx.arg[1])';
4217- }
4218-```
4219-
4220-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.
4221-
4222-Likewise, new "eof" flag can also be specified by setting a boolean value to [ngx.arg](#ngxarg)\[2\]. For example,
4223-
4224-```nginx
4225-
4226- location /t {
4227- echo hello world;
4228- echo hiya globe;
4229-
4230- body_filter_by_lua '
4231- local chunk = ngx.arg[1]
4232- if string.match(chunk, "hello") then
4233- ngx.arg[2] = true -- new eof
4234- return
4235- end
4236-
4237- -- just throw away any remaining chunk data
4238- ngx.arg[1] = nil
4239- ';
4240- }
4241-```
4242-
4243-Then `GET /t` will just return the output
4244-
4245-
4246- hello world
4247-
4248-
4249-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.
4250-
4251-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
4252-
4253-```nginx
4254-
4255- location /foo {
4256- # fastcgi_pass/proxy_pass/...
4257-
4258- header_filter_by_lua_block { ngx.header.content_length = nil }
4259- body_filter_by_lua 'ngx.arg[1] = string.len(ngx.arg[1]) .. "\\n"';
4260- }
4261-```
4262-
4263-Note that the following API functions are currently disabled within this context due to the limitations in NGINX output filter's current implementation:
4264-
4265-* Output API functions (e.g., [ngx.say](#ngxsay) and [ngx.send_headers](#ngxsend_headers))
4266-* Control API functions (e.g., [ngx.exit](#ngxexit) and [ngx.exec](#ngxexec))
4267-* Subrequest API functions (e.g., [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi))
4268-* Cosocket API functions (e.g., [ngx.socket.tcp](#ngxsockettcp) and [ngx.req.socket](#ngxreqsocket)).
4269-
4270-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.
4271-
4272-This directive was first introduced in the `v0.5.0rc32` release.
4273-
4274-[Back to TOC](#directives)
4275-
4276-body_filter_by_lua_block
4277-------------------------
4278-
4279-**syntax:** *body_filter_by_lua_block { lua-script-str }*
4280-
4281-**context:** *http, server, location, location if*
4282-
4283-**phase:** *output-body-filter*
4284-
4285-Similar to the [body_filter_by_lua](#body_filter_by_lua) directive except that this directive inlines
4286-the Lua source directly
4287-inside a pair of curly braces (`{}`) instead of in an NGINX string literal (which requires
4288-special character escaping).
4289-
4290-For instance,
4291-
4292-```nginx
4293-
4294- body_filter_by_lua_block {
4295- local data, eof = ngx.arg[1], ngx.arg[2]
4296- }
4297-```
4298-
4299-This directive was first introduced in the `v0.9.17` release.
4300-
4301-[Back to TOC](#directives)
4302-
4303-body_filter_by_lua_file
4304------------------------
4305-
4306-**syntax:** *body_filter_by_lua_file &lt;path-to-lua-script-file&gt;*
4307-
4308-**context:** *http, server, location, location if*
4309-
4310-**phase:** *output-body-filter*
4311-
4312-Equivalent to [body_filter_by_lua](#body_filter_by_lua), except that the file specified by `<path-to-lua-script-file>` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed.
4313-
4314-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.
4315-
4316-This directive was first introduced in the `v0.5.0rc32` release.
4317-
4318-[Back to TOC](#directives)
4319-
4320-log_by_lua
4321-----------
4322-
4323-**syntax:** *log_by_lua &lt;lua-script-str&gt;*
4324-
4325-**context:** *http, server, location, location if*
4326-
4327-**phase:** *log*
4328-
4329-**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.
4330-
4331-Runs the Lua source code inlined as the `<lua-script-str>` at the `log` request processing phase. This does not replace the current access logs, but runs before.
4332-
4333-Note that the following API functions are currently disabled within this context:
4334-
4335-* Output API functions (e.g., [ngx.say](#ngxsay) and [ngx.send_headers](#ngxsend_headers))
4336-* Control API functions (e.g., [ngx.exit](#ngxexit))
4337-* Subrequest API functions (e.g., [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi))
4338-* Cosocket API functions (e.g., [ngx.socket.tcp](#ngxsockettcp) and [ngx.req.socket](#ngxreqsocket)).
4339-
4340-Here is an example of gathering average data for [$upstream_response_time](http://nginx.org/en/docs/http/ngx_http_upstream_module.html#var_upstream_response_time):
4341-
4342-```nginx
4343-
4344- lua_shared_dict log_dict 5M;
4345-
4346- server {
4347- location / {
4348- proxy_pass http://mybackend;
4349-
4350- log_by_lua '
4351- local log_dict = ngx.shared.log_dict
4352- local upstream_time = tonumber(ngx.var.upstream_response_time)
4353-
4354- local sum = log_dict:get("upstream_time-sum") or 0
4355- sum = sum + upstream_time
4356- log_dict:set("upstream_time-sum", sum)
4357-
4358- local newval, err = log_dict:incr("upstream_time-nb", 1)
4359- if not newval and err == "not found" then
4360- log_dict:add("upstream_time-nb", 0)
4361- log_dict:incr("upstream_time-nb", 1)
4362- end
4363- ';
4364- }
4365-
4366- location = /status {
4367- content_by_lua_block {
4368- local log_dict = ngx.shared.log_dict
4369- local sum = log_dict:get("upstream_time-sum")
4370- local nb = log_dict:get("upstream_time-nb")
4371-
4372- if nb and sum then
4373- ngx.say("average upstream response time: ", sum / nb,
4374- " (", nb, " reqs)")
4375- else
4376- ngx.say("no data yet")
4377- end
4378- }
4379- }
4380- }
4381-```
4382-
4383-This directive was first introduced in the `v0.5.0rc31` release.
4384-
4385-[Back to TOC](#directives)
4386-
4387-log_by_lua_block
4388-----------------
4389-
4390-**syntax:** *log_by_lua_block { lua-script }*
4391-
4392-**context:** *http, server, location, location if*
4393-
4394-**phase:** *log*
4395-
4396-Similar to the [log_by_lua](#log_by_lua) directive except that this directive inlines
4397-the Lua source directly
4398-inside a pair of curly braces (`{}`) instead of in an NGINX string literal (which requires
4399-special character escaping).
4400-
4401-For instance,
4402-
4403-```nginx
4404-
4405- log_by_lua_block {
4406- print("I need no extra escaping here, for example: \r\nblah")
4407- }
4408-```
4409-
4410-This directive was first introduced in the `v0.9.17` release.
4411-
4412-[Back to TOC](#directives)
4413-
4414-log_by_lua_file
4415----------------
4416-
4417-**syntax:** *log_by_lua_file &lt;path-to-lua-script-file&gt;*
4418-
4419-**context:** *http, server, location, location if*
4420-
4421-**phase:** *log*
4422-
4423-Equivalent to [log_by_lua](#log_by_lua), except that the file specified by `<path-to-lua-script-file>` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed.
4424-
4425-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.
4426-
4427-This directive was first introduced in the `v0.5.0rc31` release.
4428-
4429-[Back to TOC](#directives)
4430-
4431-balancer_by_lua_block
4432----------------------
4433-
4434-**syntax:** *balancer_by_lua_block { lua-script }*
4435-
4436-**context:** *upstream*
4437-
4438-**phase:** *content*
4439-
4440-This directive runs Lua code as an upstream balancer for any upstream entities defined
4441-by the `upstream {}` configuration block.
4442-
4443-For instance,
4444-
4445-```nginx
4446-
4447- upstream foo {
4448- server 127.0.0.1;
4449- balancer_by_lua_block {
4450- -- use Lua to do something interesting here
4451- -- as a dynamic balancer
4452- }
4453- }
4454-
4455- server {
4456- location / {
4457- proxy_pass http://foo;
4458- }
4459- }
4460-```
4461-
4462-The resulting Lua load balancer can work with any existing nginx upstream modules
4463-like [ngx_proxy](http://nginx.org/en/docs/http/ngx_http_proxy_module.html) and
4464-[ngx_fastcgi](http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html).
4465-
4466-Also, the Lua load balancer can work with the standard upstream connection pool mechanism,
4467-i.e., the standard [keepalive](http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive) directive.
4468-Just ensure that the [keepalive](http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive) directive
4469-is used *after* this `balancer_by_lua_block` directive in a single `upstream {}` configuration block.
4470-
4471-The Lua load balancer can totally ignore the list of servers defined in the `upstream {}` block
4472-and select peer from a completely dynamic server list (even changing per request) via the
4473-[ngx.balancer](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/balancer.md) module
4474-from the [lua-resty-core](https://github.com/openresty/lua-resty-core) library.
4475-
4476-The Lua code handler registered by this directive might get called more than once in a single
4477-downstream request when the nginx upstream mechanism retries the request on conditions
4478-specified by directives like the [proxy_next_upstream](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream)
4479-directive.
4480-
4481-This Lua code execution context does not support yielding, so Lua APIs that may yield
4482-(like cosockets and "light threads") are disabled in this context. One can usually work
4483-around this limitation by doing such operations in an earlier phase handler (like
4484-[access_by_lua*](#access_by_lua)) and passing along the result into this context
4485-via the [ngx.ctx](#ngxctx) table.
4486-
4487-This directive was first introduced in the `v0.10.0` release.
4488-
4489-[Back to TOC](#directives)
4490-
4491-balancer_by_lua_file
4492---------------------
4493-
4494-**syntax:** *balancer_by_lua_file &lt;path-to-lua-script-file&gt;*
4495-
4496-**context:** *upstream*
4497-
4498-**phase:** *content*
4499-
4500-Equivalent to [balancer_by_lua_block](#balancer_by_lua_block), except that the file specified by `<path-to-lua-script-file>` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed.
4501-
4502-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.
4503-
4504-This directive was first introduced in the `v0.10.0` release.
4505-
4506-[Back to TOC](#directives)
4507-
4508-lua_need_request_body
4509----------------------
4510-
4511-**syntax:** *lua_need_request_body &lt;on|off&gt;*
4512-
4513-**default:** *off*
4514-
4515-**context:** *http, server, location, location if*
4516-
4517-**phase:** *depends on usage*
4518-
4519-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](#ngxreqread_body) function should be called within the Lua code.
4520-
4521-To read the request body data within the [$request_body](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_body) variable,
4522-[client_body_buffer_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size) must have the same value as [client_max_body_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size). Because when the content length exceeds [client_body_buffer_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size) but less than [client_max_body_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size), Nginx will buffer the data into a temporary file on the disk, which will lead to empty value in the [$request_body](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_body) variable.
4523-
4524-If the current location includes [rewrite_by_lua*](#rewrite_by_lua) directives,
4525-then the request body will be read just before the [rewrite_by_lua*](#rewrite_by_lua) code is run (and also at the
4526-`rewrite` phase). Similarly, if only [content_by_lua](#content_by_lua) is specified,
4527-the request body will not be read until the content handler's Lua code is
4528-about to run (i.e., the request body will be read during the content phase).
4529-
4530-It is recommended however, to use the [ngx.req.read_body](#ngxreqread_body) and [ngx.req.discard_body](#ngxreqdiscard_body) functions for finer control over the request body reading process instead.
4531-
4532-This also applies to [access_by_lua*](#access_by_lua).
4533-
4534-[Back to TOC](#directives)
4535-
4536-ssl_certificate_by_lua_block
4537-----------------------------
4538-
4539-**syntax:** *ssl_certificate_by_lua_block { lua-script }*
4540-
4541-**context:** *server*
4542-
4543-**phase:** *right-before-SSL-handshake*
4544-
4545-This directive runs user Lua code when NGINX is about to start the SSL handshake for the downstream
4546-SSL (https) connections.
4547-
4548-It is particularly useful for setting the SSL certificate chain and the corresponding private key on a per-request
4549-basis. It is also useful to load such handshake configurations nonblockingly from the remote (for example,
4550-with the [cosocket](#ngxsockettcp) API). And one can also do per-request OCSP stapling handling in pure
4551-Lua here as well.
4552-
4553-Another typical use case is to do SSL handshake traffic control nonblockingly in this context,
4554-with the help of the [lua-resty-limit-traffic#readme](https://github.com/openresty/lua-resty-limit-traffic)
4555-library, for example.
4556-
4557-One can also do interesting things with the SSL handshake requests from the client side, like
4558-rejecting old SSL clients using the SSLv3 protocol or even below selectively.
4559-
4560-The [ngx.ssl](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl.md)
4561-and [ngx.ocsp](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ocsp.md) Lua modules
4562-provided by the [lua-resty-core](https://github.com/openresty/lua-resty-core/#readme)
4563-library are particularly useful in this context. You can use the Lua API offered by these two Lua modules
4564-to manipulate the SSL certificate chain and private key for the current SSL connection
4565-being initiated.
4566-
4567-This Lua handler does not run at all, however, when NGINX/OpenSSL successfully resumes
4568-the SSL session via SSL session IDs or TLS session tickets for the current SSL connection. In
4569-other words, this Lua handler only runs when NGINX has to initiate a full SSL handshake.
4570-
4571-Below is a trivial example using the
4572-[ngx.ssl](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl.md) module
4573-at the same time:
4574-
4575-```nginx
4576-
4577- server {
4578- listen 443 ssl;
4579- server_name test.com;
4580-
4581- ssl_certificate_by_lua_block {
4582- print("About to initiate a new SSL handshake!")
4583- }
4584-
4585- location / {
4586- root html;
4587- }
4588- }
4589-```
4590-
4591-See more complicated examples in the [ngx.ssl](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl.md)
4592-and [ngx.ocsp](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ocsp.md)
4593-Lua modules' official documentation.
4594-
4595-Uncaught Lua exceptions in the user Lua code immediately abort the current SSL session, so does the
4596-[ngx.exit](#ngxexit) call with an error code like `ngx.ERROR`.
4597-
4598-This Lua code execution context *does* support yielding, so Lua APIs that may yield
4599-(like cosockets, sleeping, and "light threads")
4600-are enabled in this context.
4601-
4602-Note, however, you still need to configure the [ssl_certificate](http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate) and
4603-[ssl_certificate_key](http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate_key)
4604-directives even though you will not use this static certificate and private key at all. This is
4605-because the NGINX core requires their appearance otherwise you are seeing the following error
4606-while starting NGINX:
4607-
4608-
4609- nginx: [emerg] no ssl configured for the server
4610-
4611-
4612-This directive currently requires the following NGINX core patch to work correctly:
4613-
4614-<http://mailman.nginx.org/pipermail/nginx-devel/2016-January/007748.html>
4615-
4616-The bundled version of the NGINX core in OpenResty 1.9.7.2 (or above) already has this
4617-patch applied.
4618-
4619-Furthermore, one needs at least OpenSSL 1.0.2e for this directive to work.
4620-
4621-This directive was first introduced in the `v0.10.0` release.
4622-
4623-[Back to TOC](#directives)
4624-
4625-ssl_certificate_by_lua_file
4626----------------------------
4627-
4628-**syntax:** *ssl_certificate_by_lua_file &lt;path-to-lua-script-file&gt;*
4629-
4630-**context:** *server*
4631-
4632-**phase:** *right-before-SSL-handshake*
4633-
4634-Equivalent to [ssl_certificate_by_lua_block](#ssl_certificate_by_lua_block), except that the file specified by `<path-to-lua-script-file>` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed.
4635-
4636-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.
4637-
4638-This directive was first introduced in the `v0.10.0` release.
4639-
4640-[Back to TOC](#directives)
4641-
4642-ssl_session_fetch_by_lua_block
4643-------------------------------
4644-
4645-**syntax:** *ssl_session_fetch_by_lua_block { lua-script }*
4646-
4647-**context:** *http*
4648-
4649-**phase:** *right-before-SSL-handshake*
4650-
4651-This directive runs Lua code to look up and load the SSL session (if any) according to the session ID
4652-provided by the current SSL handshake request for the downstream.
4653-
4654-The Lua API for obtaining the current session ID and loading a cached SSL session data
4655-is provided in the [ngx.ssl.session](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl/session.md)
4656-Lua module shipped with the [lua-resty-core](https://github.com/openresty/lua-resty-core#readme)
4657-library.
4658-
4659-Lua APIs that may yield, like [ngx.sleep](#ngxsleep) and [cosockets](#ngxsockettcp),
4660-are enabled in this context.
4661-
4662-This hook, together with the [ssl_session_store_by_lua*](#ssl_session_store_by_lua_block) hook,
4663-can be used to implement distributed caching mechanisms in pure Lua (based
4664-on the [cosocket](#ngxsockettcp) API, for example). If a cached SSL session is found
4665-and loaded into the current SSL connection context,
4666-SSL session resumption can then get immediately initiated and bypass the full SSL handshake process which is very expensive in terms of CPU time.
4667-
4668-Please note that TLS session tickets are very different and it is the clients' responsibility
4669-to cache the SSL session state when session tickets are used. SSL session resumptions based on
4670-TLS session tickets would happen automatically without going through this hook (nor the
4671-[ssl_session_store_by_lua_block](#ssl_session_store_by_lua) hook). This hook is mainly
4672-for older or less capable SSL clients that can only do SSL sessions by session IDs.
4673-
4674-When [ssl_certificate_by_lua*](#ssl_certificate_by_lua_block) is specified at the same time,
4675-this hook usually runs before [ssl_certificate_by_lua*](#ssl_certificate_by_lua_block).
4676-When the SSL session is found and successfully loaded for the current SSL connection,
4677-SSL session resumption will happen and thus bypass the [ssl_certificate_by_lua*](#ssl_certificate_by_lua_block)
4678-hook completely. In this case, NGINX also bypasses the [ssl_session_store_by_lua_block](#ssl_session_store_by_lua)
4679-hook, for obvious reasons.
4680-
4681-To easily test this hook locally with a modern web browser, you can temporarily put the following line
4682-in your https server block to disable the TLS session ticket support:
4683-
4684- ssl_session_tickets off;
4685-
4686-But do not forget to comment this line out before publishing your site to the world.
4687-
4688-If you are using the [official pre-built packages](http://openresty.org/en/linux-packages.html) for [OpenResty](https://openresty.org/)
4689-1.11.2.1 or later, then everything should work out of the box.
4690-
4691-If you are using OpenSSL libraries not provided by [OpenResty](https://openresty.org),
4692-then you need to apply the following patch for OpenSSL 1.0.2h or later:
4693-
4694-<https://github.com/openresty/openresty/blob/master/patches/openssl-1.0.2h-sess_set_get_cb_yield.patch>
4695-
4696-If you are not using the NGINX core shipped with [OpenResty](https://openresty.org) 1.11.2.1 or later, then you need to
4697-apply the following patch to the standard NGINX core 1.11.2 or later:
4698-
4699-<http://openresty.org/download/nginx-1.11.2-nonblocking_ssl_handshake_hooks.patch>
4700-
4701-This directive was first introduced in the `v0.10.6` release.
4702-
4703-Note that: this directive is only allowed to used in **http context** from the `v0.10.7` release
4704-(because SSL session resumption happens before server name dispatch).
4705-
4706-[Back to TOC](#directives)
4707-
4708-ssl_session_fetch_by_lua_file
4709------------------------------
4710-
4711-**syntax:** *ssl_session_fetch_by_lua_file &lt;path-to-lua-script-file&gt;*
4712-
4713-**context:** *http*
4714-
4715-**phase:** *right-before-SSL-handshake*
4716-
4717-Equivalent to [ssl_session_fetch_by_lua_block](#ssl_session_fetch_by_lua_block), except that the file specified by `<path-to-lua-script-file>` contains the Lua code, or rather, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed.
4718-
4719-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.
4720-
4721-This directive was first introduced in the `v0.10.6` release.
4722-
4723-Note that: this directive is only allowed to used in **http context** from the `v0.10.7` release
4724-(because SSL session resumption happens before server name dispatch).
4725-
4726-[Back to TOC](#directives)
4727-
4728-ssl_session_store_by_lua_block
4729-------------------------------
4730-
4731-**syntax:** *ssl_session_store_by_lua_block { lua-script }*
4732-
4733-**context:** *http*
4734-
4735-**phase:** *right-after-SSL-handshake*
4736-
4737-This directive runs Lua code to fetch and save the SSL session (if any) according to the session ID
4738-provided by the current SSL handshake request for the downstream. The saved or cached SSL
4739-session data can be used for future SSL connections to resume SSL sessions without going
4740-through the full SSL handshake process (which is very expensive in terms of CPU time).
4741-
4742-Lua APIs that may yield, like [ngx.sleep](#ngxsleep) and [cosockets](#ngxsockettcp),
4743-are *disabled* in this context. You can still, however, use the [ngx.timer.at](#ngxtimerat) API
4744-to create 0-delay timers to save the SSL session data asynchronously to external services (like `redis` or `memcached`).
4745-
4746-The Lua API for obtaining the current session ID and the associated session state data
4747-is provided in the [ngx.ssl.session](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl/session.md#readme)
4748-Lua module shipped with the [lua-resty-core](https://github.com/openresty/lua-resty-core#readme)
4749-library.
4750-
4751-To easily test this hook locally with a modern web browser, you can temporarily put the following line
4752-in your https server block to disable the TLS session ticket support:
4753-
4754- ssl_session_tickets off;
4755-
4756-But do not forget to comment this line out before publishing your site to the world.
4757-
4758-This directive was first introduced in the `v0.10.6` release.
4759-
4760-Note that: this directive is only allowed to used in **http context** from the `v0.10.7` release
4761-(because SSL session resumption happens before server name dispatch).
4762-
4763-[Back to TOC](#directives)
4764-
4765-ssl_session_store_by_lua_file
4766------------------------------
4767-
4768-**syntax:** *ssl_session_store_by_lua_file &lt;path-to-lua-script-file&gt;*
4769-
4770-**context:** *http*
4771-
4772-**phase:** *right-after-SSL-handshake*
4773-
4774-Equivalent to [ssl_session_store_by_lua_block](#ssl_session_store_by_lua_block), except that the file specified by `<path-to-lua-script-file>` contains the Lua code, or rather, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed.
4775-
4776-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.
4777-
4778-This directive was first introduced in the `v0.10.6` release.
4779-
4780-Note that: this directive is only allowed to used in **http context** from the `v0.10.7` release
4781-(because SSL session resumption happens before server name dispatch).
4782-
4783-[Back to TOC](#directives)
4784-
4785-lua_shared_dict
4786----------------
4787-
4788-**syntax:** *lua_shared_dict &lt;name&gt; &lt;size&gt;*
4789-
4790-**default:** *no*
4791-
4792-**context:** *http*
4793-
4794-**phase:** *depends on usage*
4795-
4796-Declares a shared memory zone, `<name>`, to serve as storage for the shm based Lua dictionary `ngx.shared.<name>`.
4797-
4798-Shared memory zones are always shared by all the nginx worker processes in the current nginx server instance.
4799-
4800-The `<size>` argument accepts size units such as `k` and `m`:
4801-
4802-```nginx
4803-
4804- http {
4805- lua_shared_dict dogs 10m;
4806- ...
4807- }
4808-```
4809-
4810-The hard-coded minimum size is 8KB while the practical minimum size depends
4811-on actual user data set (some people start with 12KB).
4812-
4813-See [ngx.shared.DICT](#ngxshareddict) for details.
4814-
4815-This directive was first introduced in the `v0.3.1rc22` release.
4816-
4817-[Back to TOC](#directives)
4818-
4819-lua_socket_connect_timeout
4820---------------------------
4821-
4822-**syntax:** *lua_socket_connect_timeout &lt;time&gt;*
4823-
4824-**default:** *lua_socket_connect_timeout 60s*
4825-
4826-**context:** *http, server, location*
4827-
4828-This directive controls the default timeout value used in TCP/unix-domain socket object's [connect](#tcpsockconnect) method and can be overridden by the [settimeout](#tcpsocksettimeout) or [settimeouts](#tcpsocksettimeouts) methods.
4829-
4830-The `<time>` argument can be an integer, with an optional time unit, like `s` (second), `ms` (millisecond), `m` (minute). The default time unit is `s`, i.e., "second". The default setting is `60s`.
4831-
4832-This directive was first introduced in the `v0.5.0rc1` release.
4833-
4834-[Back to TOC](#directives)
4835-
4836-lua_socket_send_timeout
4837------------------------
4838-
4839-**syntax:** *lua_socket_send_timeout &lt;time&gt;*
4840-
4841-**default:** *lua_socket_send_timeout 60s*
4842-
4843-**context:** *http, server, location*
4844-
4845-Controls the default timeout value used in TCP/unix-domain socket object's [send](#tcpsocksend) method and can be overridden by the [settimeout](#tcpsocksettimeout) or [settimeouts](#tcpsocksettimeouts) methods.
4846-
4847-The `<time>` argument can be an integer, with an optional time unit, like `s` (second), `ms` (millisecond), `m` (minute). The default time unit is `s`, i.e., "second". The default setting is `60s`.
4848-
4849-This directive was first introduced in the `v0.5.0rc1` release.
4850-
4851-[Back to TOC](#directives)
4852-
4853-lua_socket_send_lowat
4854----------------------
4855-
4856-**syntax:** *lua_socket_send_lowat &lt;size&gt;*
4857-
4858-**default:** *lua_socket_send_lowat 0*
4859-
4860-**context:** *http, server, location*
4861-
4862-Controls the `lowat` (low water) value for the cosocket send buffer.
4863-
4864-[Back to TOC](#directives)
4865-
4866-lua_socket_read_timeout
4867------------------------
4868-
4869-**syntax:** *lua_socket_read_timeout &lt;time&gt;*
4870-
4871-**default:** *lua_socket_read_timeout 60s*
4872-
4873-**context:** *http, server, location*
4874-
4875-**phase:** *depends on usage*
4876-
4877-This directive controls the default timeout value used in TCP/unix-domain socket object's [receive](#tcpsockreceive) method and iterator functions returned by the [receiveuntil](#tcpsockreceiveuntil) method. This setting can be overridden by the [settimeout](#tcpsocksettimeout) or [settimeouts](#tcpsocksettimeouts) methods.
4878-
4879-The `<time>` argument can be an integer, with an optional time unit, like `s` (second), `ms` (millisecond), `m` (minute). The default time unit is `s`, i.e., "second". The default setting is `60s`.
4880-
4881-This directive was first introduced in the `v0.5.0rc1` release.
4882-
4883-[Back to TOC](#directives)
4884-
4885-lua_socket_buffer_size
4886-----------------------
4887-
4888-**syntax:** *lua_socket_buffer_size &lt;size&gt;*
4889-
4890-**default:** *lua_socket_buffer_size 4k/8k*
4891-
4892-**context:** *http, server, location*
4893-
4894-Specifies the buffer size used by cosocket reading operations.
4895-
4896-This buffer does not have to be that big to hold everything at the same time because cosocket supports 100% non-buffered reading and parsing. So even `1` byte buffer size should still work everywhere but the performance could be terrible.
4897-
4898-This directive was first introduced in the `v0.5.0rc1` release.
4899-
4900-[Back to TOC](#directives)
4901-
4902-lua_socket_pool_size
4903---------------------
4904-
4905-**syntax:** *lua_socket_pool_size &lt;size&gt;*
4906-
4907-**default:** *lua_socket_pool_size 30*
4908-
4909-**context:** *http, server, location*
4910-
4911-Specifies the size limit (in terms of connection count) for every cosocket connection pool associated with every remote server (i.e., identified by either the host-port pair or the unix domain socket file path).
4912-
4913-Default to 30 connections for every pool.
4914-
4915-When the connection pool exceeds the available size limit, the least recently used (idle) connection already in the pool will be closed to make room for the current connection.
4916-
4917-Note that the cosocket connection pool is per nginx worker process rather than per nginx server instance, so size limit specified here also applies to every single nginx worker process.
4918-
4919-This directive was first introduced in the `v0.5.0rc1` release.
4920-
4921-[Back to TOC](#directives)
4922-
4923-lua_socket_keepalive_timeout
4924-----------------------------
4925-
4926-**syntax:** *lua_socket_keepalive_timeout &lt;time&gt;*
4927-
4928-**default:** *lua_socket_keepalive_timeout 60s*
4929-
4930-**context:** *http, server, location*
4931-
4932-This directive controls the default maximal idle time of the connections in the cosocket built-in connection pool. When this timeout reaches, idle connections will be closed and removed from the pool. This setting can be overridden by cosocket objects' [setkeepalive](#tcpsocksetkeepalive) method.
4933-
4934-The `<time>` argument can be an integer, with an optional time unit, like `s` (second), `ms` (millisecond), `m` (minute). The default time unit is `s`, i.e., "second". The default setting is `60s`.
4935-
4936-This directive was first introduced in the `v0.5.0rc1` release.
4937-
4938-[Back to TOC](#directives)
4939-
4940-lua_socket_log_errors
4941----------------------
4942-
4943-**syntax:** *lua_socket_log_errors on|off*
4944-
4945-**default:** *lua_socket_log_errors on*
4946-
4947-**context:** *http, server, location*
4948-
4949-This directive can be used to toggle error logging when a failure occurs for the TCP or UDP cosockets. If you are already doing proper error handling and logging in your Lua code, then it is recommended to turn this directive off to prevent data flushing in your nginx error log files (which is usually rather expensive).
4950-
4951-This directive was first introduced in the `v0.5.13` release.
4952-
4953-[Back to TOC](#directives)
4954-
4955-lua_ssl_ciphers
4956----------------
4957-
4958-**syntax:** *lua_ssl_ciphers &lt;ciphers&gt;*
4959-
4960-**default:** *lua_ssl_ciphers DEFAULT*
4961-
4962-**context:** *http, server, location*
4963-
4964-Specifies the enabled ciphers for requests to a SSL/TLS server in the [tcpsock:sslhandshake](#tcpsocksslhandshake) method. The ciphers are specified in the format understood by the OpenSSL library.
4965-
4966-The full list can be viewed using the “openssl ciphers” command.
4967-
4968-This directive was first introduced in the `v0.9.11` release.
4969-
4970-[Back to TOC](#directives)
4971-
4972-lua_ssl_crl
4973------------
4974-
4975-**syntax:** *lua_ssl_crl &lt;file&gt;*
4976-
4977-**default:** *no*
4978-
4979-**context:** *http, server, location*
4980-
4981-Specifies a file with revoked certificates (CRL) in the PEM format used to verify the certificate of the SSL/TLS server in the [tcpsock:sslhandshake](#tcpsocksslhandshake) method.
4982-
4983-This directive was first introduced in the `v0.9.11` release.
4984-
4985-[Back to TOC](#directives)
4986-
4987-lua_ssl_protocols
4988------------------
4989-
4990-**syntax:** *lua_ssl_protocols \[SSLv2\] \[SSLv3\] \[TLSv1\] [TLSv1.1] [TLSv1.2] [TLSv1.3]*
4991-
4992-**default:** *lua_ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2*
4993-
4994-**context:** *http, server, location*
4995-
4996-Enables the specified protocols for requests to a SSL/TLS server in the [tcpsock:sslhandshake](#tcpsocksslhandshake) method.
4997-
4998-The support for the `TLSv1.3` parameter requires version `v0.10.12` *and* OpenSSL 1.1.1.
4999-
5000-This directive was first introduced in the `v0.9.11` release.
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches