annotate auto/os/solaris @ 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 e393c0bf53d3
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: 433
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: 433
diff changeset
2 # Copyright (C) Igor Sysoev
4412
d620f497c50f Copyright updated.
Maxim Konovalov <maxim@nginx.com>
parents: 2816
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: 433
diff changeset
4
196
11fbd0fc041d nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
5
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
6 have=NGX_SOLARIS . auto/have_headers
455
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 448
diff changeset
7
196
11fbd0fc041d nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
8 CORE_INCS="$UNIX_INCS"
11fbd0fc041d nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
9 CORE_DEPS="$UNIX_DEPS $SOLARIS_DEPS"
249
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 248
diff changeset
10 CORE_SRCS="$UNIX_SRCS $SOLARIS_SRCS "
2816
af0eaf409225 Solaris 10 has sched_yield() in libc
Igor Sysoev <igor@sysoev.ru>
parents: 1490
diff changeset
11 CORE_LIBS="$CORE_LIBS -lsocket -lnsl"
196
11fbd0fc041d nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
12
1490
111c571f431c add rpath for Solaris
Igor Sysoev <igor@sysoev.ru>
parents: 875
diff changeset
13 NGX_RPATH=YES
111c571f431c add rpath for Solaris
Igor Sysoev <igor@sysoev.ru>
parents: 875
diff changeset
14
455
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 448
diff changeset
15 # Solaris's make does not support a blank line between target and rules
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 448
diff changeset
16 ngx_spacer=
283
8f65fee68270 nginx-0.0.2-2004-03-10-20:55:19 import
Igor Sysoev <igor@sysoev.ru>
parents: 281
diff changeset
17
2816
af0eaf409225 Solaris 10 has sched_yield() in libc
Igor Sysoev <igor@sysoev.ru>
parents: 1490
diff changeset
18 CC_AUX_FLAGS="$CC_AUX_FLAGS -D_FILE_OFFSET_BITS=64 -lsocket -lnsl"
433
9a97dcdd2421 nginx-0.0.11-2004-09-21-19:47:05 import
Igor Sysoev <igor@sysoev.ru>
parents: 425
diff changeset
19
9a97dcdd2421 nginx-0.0.11-2004-09-21-19:47:05 import
Igor Sysoev <igor@sysoev.ru>
parents: 425
diff changeset
20
285
8f48e6366d09 nginx-0.0.2-2004-03-11-18:42:41 import
Igor Sysoev <igor@sysoev.ru>
parents: 283
diff changeset
21 if [ $ZLIB_ASM != NO ]; then
8f48e6366d09 nginx-0.0.2-2004-03-11-18:42:41 import
Igor Sysoev <igor@sysoev.ru>
parents: 283
diff changeset
22 echo "$0: error: the --with-zlib-asm=CPU option is not supported"
8f48e6366d09 nginx-0.0.2-2004-03-11-18:42:41 import
Igor Sysoev <igor@sysoev.ru>
parents: 283
diff changeset
23 echo "on that platform"
8f48e6366d09 nginx-0.0.2-2004-03-11-18:42:41 import
Igor Sysoev <igor@sysoev.ru>
parents: 283
diff changeset
24 echo
8f48e6366d09 nginx-0.0.2-2004-03-11-18:42:41 import
Igor Sysoev <igor@sysoev.ru>
parents: 283
diff changeset
25
8f48e6366d09 nginx-0.0.2-2004-03-11-18:42:41 import
Igor Sysoev <igor@sysoev.ru>
parents: 283
diff changeset
26 exit 1
8f48e6366d09 nginx-0.0.2-2004-03-11-18:42:41 import
Igor Sysoev <igor@sysoev.ru>
parents: 283
diff changeset
27 fi
8f48e6366d09 nginx-0.0.2-2004-03-11-18:42:41 import
Igor Sysoev <igor@sysoev.ru>
parents: 283
diff changeset
28
196
11fbd0fc041d nginx-0.0.1-2003-11-26-18:42:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
29
455
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 448
diff changeset
30 ngx_feature="sendfilev()"
469
2ff194b74f1e nginx-0.1.9-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 455
diff changeset
31 ngx_feature_name="NGX_HAVE_SENDFILE"
455
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 448
diff changeset
32 ngx_feature_run=no
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 448
diff changeset
33 ngx_feature_incs="#include <sys/sendfile.h>"
875
7af8276b1c2f test PCRE in FreeBSD, Linux, and NetBSD
Igor Sysoev <igor@sysoev.ru>
parents: 719
diff changeset
34 ngx_feature_path=
455
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 448
diff changeset
35 ngx_feature_libs="-lsendfile"
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 448
diff changeset
36 ngx_feature_test="int fd = 1; sendfilevec_t vec[1];
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 448
diff changeset
37 size_t sent; ssize_t n;
4559
62d8db8c7157 Fixed more gcc46 warnings in configure tests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
38 n = sendfilev(fd, vec, 1, &sent);
62d8db8c7157 Fixed more gcc46 warnings in configure tests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
39 if (n == -1) return 1"
455
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 448
diff changeset
40 . auto/feature
197
0b81c7a0b133 nginx-0.0.1-2003-11-27-10:45:22 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
41
248
e885208c518b nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 198
diff changeset
42
e885208c518b nginx-0.0.2-2004-02-03-00:19:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 198
diff changeset
43 if [ $ngx_found = yes ]; then
197
0b81c7a0b133 nginx-0.0.1-2003-11-27-10:45:22 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
44 CORE_SRCS="$CORE_SRCS $SOLARIS_SENDFILEV_SRCS"
0b81c7a0b133 nginx-0.0.1-2003-11-27-10:45:22 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
45 CORE_LIBS="$CORE_LIBS -lsendfile"
0b81c7a0b133 nginx-0.0.1-2003-11-27-10:45:22 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
46 fi
719
f30b1a75fd3b Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
47
f30b1a75fd3b Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
48
f30b1a75fd3b Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
49 ngx_feature="event ports"
f30b1a75fd3b Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
50 ngx_feature_name="NGX_HAVE_EVENTPORT"
f30b1a75fd3b Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
51 ngx_feature_run=no
f30b1a75fd3b Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
52 ngx_feature_incs="#include <port.h>"
875
7af8276b1c2f test PCRE in FreeBSD, Linux, and NetBSD
Igor Sysoev <igor@sysoev.ru>
parents: 719
diff changeset
53 ngx_feature_path=
719
f30b1a75fd3b Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
54 ngx_feature_libs=
6622
e393c0bf53d3 Configure: fix build with -Werror=unused-but-set-variable.
Piotr Sikora <piotrsikora@google.com>
parents: 4559
diff changeset
55 ngx_feature_test="(void) port_create()"
719
f30b1a75fd3b Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
56 . auto/feature
f30b1a75fd3b Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
57
f30b1a75fd3b Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
58 if [ $ngx_found = yes ]; then
f30b1a75fd3b Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
59 CORE_SRCS="$CORE_SRCS $EVENTPORT_SRCS"
f30b1a75fd3b Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
60 EVENT_MODULES="$EVENT_MODULES $EVENTPORT_MODULE"
f30b1a75fd3b Solaris 10 event ports support
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
61 fi