annotate auto/lib/zlib/conf @ 9017:106328a70f4e

Added warning about redefinition of listen socket protocol options. The "listen" directive in the http module can be used multiple times in different server blocks. Originally, it was supposed to be specified once with various socket options, and without any parameters in virtual server blocks. For example: server { listen 80 backlog=1024; server_name foo; ... } server { listen 80; server_name bar; ... } server { listen 80; server_name bazz; ... } The address part of the syntax ("address[:port]" / "port" / "unix:path") uniquely identifies the listening socket, and therefore is enough for name-based virtual servers (to let nginx know that the virtual server accepts requests on the listening socket in question). To ensure that listening options do not conflict between virtual servers, they were allowed only once. For example, the following configuration will be rejected ("duplicate listen options for 0.0.0.0:80 in ..."): server { listen 80 backlog=1024; server_name foo; ... } server { listen 80 backlog=512; server_name bar; ... } At some point it was, however, noticed, that it is sometimes convenient to repeat some options for clarity. In nginx 0.8.51 the "ssl" parameter was allowed to be specified multiple times, e.g.: server { listen 443 ssl backlog=1024; server_name foo; ... } server { listen 443 ssl; server_name bar; ... } server { listen 443 ssl; server_name bazz; ... } This approach makes configuration more readable, since SSL sockets are immediately visible in the configuration. If this is not needed, just the address can still be used. Later, additional protocol-specific options similar to "ssl" were introduced, notably "http2" and "proxy_protocol". With these options, one can write: server { listen 443 ssl backlog=1024; server_name foo; ... } server { listen 443 http2; server_name bar; ... } server { listen 443 proxy_protocol; server_name bazz; ... } The resulting socket will use ssl, http2, and proxy_protocol, but this is not really obvious from the configuration. To emphasize such misleading configurations are discouraged, nginx now warns as long as the "listen" directive is used with options different from the options previously used if this is potentially confusing. In particular, the following configurations are allowed: server { listen 8401 ssl backlog=1024; server_name foo; } server { listen 8401 ssl; server_name bar; } server { listen 8401 ssl; server_name bazz; } server { listen 8402 ssl http2 backlog=1024; server_name foo; } server { listen 8402 ssl; server_name bar; } server { listen 8402 ssl; server_name bazz; } server { listen 8403 ssl; server_name bar; } server { listen 8403 ssl; server_name bazz; } server { listen 8403 ssl http2; server_name foo; } server { listen 8404 ssl http2 backlog=1024; server_name foo; } server { listen 8404 http2; server_name bar; } server { listen 8404 http2; server_name bazz; } server { listen 8405 ssl http2 backlog=1024; server_name foo; } server { listen 8405 ssl http2; server_name bar; } server { listen 8405 ssl http2; server_name bazz; } server { listen 8406 ssl; server_name foo; } server { listen 8406; server_name bar; } server { listen 8406; server_name bazz; } And the following configurations will generate warnings: server { listen 8501 ssl http2 backlog=1024; server_name foo; } server { listen 8501 http2; server_name bar; } server { listen 8501 ssl; server_name bazz; } server { listen 8502 backlog=1024; server_name foo; } server { listen 8502 ssl; server_name bar; } server { listen 8503 ssl; server_name foo; } server { listen 8503 http2; server_name bar; } server { listen 8504 ssl; server_name foo; } server { listen 8504 http2; server_name bar; } server { listen 8504 proxy_protocol; server_name bazz; } server { listen 8505 ssl http2 proxy_protocol; server_name foo; } server { listen 8505 ssl http2; server_name bar; } server { listen 8505 ssl; server_name bazz; } server { listen 8506 ssl http2; server_name foo; } server { listen 8506 ssl; server_name bar; } server { listen 8506; server_name bazz; } server { listen 8507 ssl; server_name bar; } server { listen 8507; server_name bazz; } server { listen 8507 ssl http2; server_name foo; } server { listen 8508 ssl; server_name bar; } server { listen 8508; server_name bazz; } server { listen 8508 ssl backlog=1024; server_name foo; } server { listen 8509; server_name bazz; } server { listen 8509 ssl; server_name bar; } server { listen 8509 ssl backlog=1024; server_name foo; } The basic idea is that at most two sets of protocol options are allowed: the main one (with socket options, if any), and a shorter one, with options being a subset of the main options, repeated for clarity. As long as the shorter set of protocol options is used, all listen directives except the main one should use it.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 28 Jan 2023 01:29:45 +0300
parents 78f8ac479735
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
444
42d11f017717 nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents: 320
diff changeset
1
42d11f017717 nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents: 320
diff changeset
2 # Copyright (C) Igor Sysoev
4412
d620f497c50f Copyright updated.
Maxim Konovalov <maxim@nginx.com>
parents: 3684
diff changeset
3 # Copyright (C) Nginx, Inc.
444
42d11f017717 nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents: 320
diff changeset
4
210
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
5
253
b6793bc5034b nginx-0.0.2-2004-02-09-10:46:43 import
Igor Sysoev <igor@sysoev.ru>
parents: 210
diff changeset
6 if [ $ZLIB != NONE ]; then
297
ee394e997c77 nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents: 295
diff changeset
7 CORE_INCS="$CORE_INCS $ZLIB"
210
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
8
455
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
9 case "$NGX_CC_NAME" in
282
30310107dbc9 nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
10
6397
78f8ac479735 Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4987
diff changeset
11 msvc | owc | bcc)
4987
66d001c5378c Configure: added the NGX_ZLIB define.
Valentin Bartenev <vbart@nginx.com>
parents: 4412
diff changeset
12 have=NGX_ZLIB . auto/have
282
30310107dbc9 nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
13 LINK_DEPS="$LINK_DEPS $ZLIB/zlib.lib"
30310107dbc9 nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
14 CORE_LIBS="$CORE_LIBS $ZLIB/zlib.lib"
30310107dbc9 nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
15 ;;
30310107dbc9 nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
16
6397
78f8ac479735 Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4987
diff changeset
17 icc)
4987
66d001c5378c Configure: added the NGX_ZLIB define.
Valentin Bartenev <vbart@nginx.com>
parents: 4412
diff changeset
18 have=NGX_ZLIB . auto/have
288
f81d075ad172 nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
19 LINK_DEPS="$LINK_DEPS $ZLIB/libz.a"
f81d075ad172 nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
20
f81d075ad172 nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
21 # to allow -ipo optimization we link with the *.o but not library
f81d075ad172 nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
22 CORE_LIBS="$CORE_LIBS $ZLIB/adler32.o"
f81d075ad172 nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
23 CORE_LIBS="$CORE_LIBS $ZLIB/crc32.o"
f81d075ad172 nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
24 CORE_LIBS="$CORE_LIBS $ZLIB/deflate.o"
f81d075ad172 nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
25 CORE_LIBS="$CORE_LIBS $ZLIB/trees.o"
f81d075ad172 nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
26 CORE_LIBS="$CORE_LIBS $ZLIB/zutil.o"
493
975f62e77f02 nginx-0.1.21-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 469
diff changeset
27 CORE_LIBS="$CORE_LIBS $ZLIB/compress.o"
288
f81d075ad172 nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
28
f81d075ad172 nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
29 if [ $ZLIB_ASM != NO ]; then
f81d075ad172 nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
30 CORE_LIBS="$CORE_LIBS $ZLIB/match.o"
f81d075ad172 nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
31 fi
f81d075ad172 nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
32 ;;
f81d075ad172 nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
33
282
30310107dbc9 nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
34 *)
4987
66d001c5378c Configure: added the NGX_ZLIB define.
Valentin Bartenev <vbart@nginx.com>
parents: 4412
diff changeset
35 have=NGX_ZLIB . auto/have
282
30310107dbc9 nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
36 LINK_DEPS="$LINK_DEPS $ZLIB/libz.a"
306
6b91bfbc4123 nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 297
diff changeset
37 CORE_LIBS="$CORE_LIBS $ZLIB/libz.a"
6b91bfbc4123 nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 297
diff changeset
38 #CORE_LIBS="$CORE_LIBS -L $ZLIB -lz"
282
30310107dbc9 nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
39 ;;
30310107dbc9 nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
40
30310107dbc9 nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents: 253
diff changeset
41 esac
210
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
42
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
43 else
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
44
493
975f62e77f02 nginx-0.1.21-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 469
diff changeset
45 if [ "$NGX_PLATFORM" != win32 ]; then
455
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
46 ZLIB=NO
320
d621239c30f7 nginx-0.0.3-2004-04-18-23:06:02 import
Igor Sysoev <igor@sysoev.ru>
parents: 307
diff changeset
47
d621239c30f7 nginx-0.0.3-2004-04-18-23:06:02 import
Igor Sysoev <igor@sysoev.ru>
parents: 307
diff changeset
48 # FreeBSD, Solaris, Linux
d621239c30f7 nginx-0.0.3-2004-04-18-23:06:02 import
Igor Sysoev <igor@sysoev.ru>
parents: 307
diff changeset
49
455
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
50 ngx_feature="zlib library"
4987
66d001c5378c Configure: added the NGX_ZLIB define.
Valentin Bartenev <vbart@nginx.com>
parents: 4412
diff changeset
51 ngx_feature_name="NGX_ZLIB"
455
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
52 ngx_feature_run=no
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
53 ngx_feature_incs="#include <zlib.h>"
875
7af8276b1c2f test PCRE in FreeBSD, Linux, and NetBSD
Igor Sysoev <igor@sysoev.ru>
parents: 493
diff changeset
54 ngx_feature_path=
455
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
55 ngx_feature_libs="-lz"
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
56 ngx_feature_test="z_stream z; deflate(&z, Z_NO_FLUSH)"
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
57 . auto/feature
210
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
58
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
59
307
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
60 if [ $ngx_found = yes ]; then
455
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
61 CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
307
ce375c313e96 nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 306
diff changeset
62 ZLIB=YES
455
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
63 ngx_found=no
3684
4d47a0658e7d stop ./configure on Win32 if no library sources was specified,
Igor Sysoev <igor@sysoev.ru>
parents: 2893
diff changeset
64 fi
4d47a0658e7d stop ./configure on Win32 if no library sources was specified,
Igor Sysoev <igor@sysoev.ru>
parents: 2893
diff changeset
65 fi
2893
da1ba8a5c8c9 stop ./configure at once on library failure
Igor Sysoev <igor@sysoev.ru>
parents: 875
diff changeset
66
3684
4d47a0658e7d stop ./configure on Win32 if no library sources was specified,
Igor Sysoev <igor@sysoev.ru>
parents: 2893
diff changeset
67 if [ $ZLIB != YES ]; then
2893
da1ba8a5c8c9 stop ./configure at once on library failure
Igor Sysoev <igor@sysoev.ru>
parents: 875
diff changeset
68 cat << END
da1ba8a5c8c9 stop ./configure at once on library failure
Igor Sysoev <igor@sysoev.ru>
parents: 875
diff changeset
69
da1ba8a5c8c9 stop ./configure at once on library failure
Igor Sysoev <igor@sysoev.ru>
parents: 875
diff changeset
70 $0: error: the HTTP gzip module requires the zlib library.
da1ba8a5c8c9 stop ./configure at once on library failure
Igor Sysoev <igor@sysoev.ru>
parents: 875
diff changeset
71 You can either disable the module by using --without-http_gzip_module
da1ba8a5c8c9 stop ./configure at once on library failure
Igor Sysoev <igor@sysoev.ru>
parents: 875
diff changeset
72 option, or install the zlib library into the system, or build the zlib library
da1ba8a5c8c9 stop ./configure at once on library failure
Igor Sysoev <igor@sysoev.ru>
parents: 875
diff changeset
73 statically from the source with nginx by using --with-zlib=<path> option.
da1ba8a5c8c9 stop ./configure at once on library failure
Igor Sysoev <igor@sysoev.ru>
parents: 875
diff changeset
74
da1ba8a5c8c9 stop ./configure at once on library failure
Igor Sysoev <igor@sysoev.ru>
parents: 875
diff changeset
75 END
3684
4d47a0658e7d stop ./configure on Win32 if no library sources was specified,
Igor Sysoev <igor@sysoev.ru>
parents: 2893
diff changeset
76 exit 1
210
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
77 fi
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
78
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
79 fi