Mercurial > hg > nginx-site
annotate xml/ru/docs/http/server_names.xml @ 1768:061b590cbe1a
Documented $bytes_received, $session_time, $protocol in stream.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Mon, 29 Aug 2016 15:13:01 +0300 |
parents | 77a3314c74a7 |
children | 30e2bd353998 |
rev | line source |
---|---|
645
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1 <!-- |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
2 Copyright (C) Igor Sysoev |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
3 Copyright (C) Nginx, Inc. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
4 --> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
5 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
6 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
7 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
8 <article name="Имена сервера" |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
9 link="/ru/docs/http/server_names.html" |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
10 lang="ru" |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
11 rev="2" |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
12 author="Игорь Сысоев" |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
13 editor="Brian Mercer"> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
14 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
15 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
16 <section> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
17 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
18 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
19 Имена сервера задаются с помощью директивы |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
20 <link doc="ngx_http_core_module.xml" id="server_name"/> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
21 и определяют, в каком блоке <link doc="ngx_http_core_module.xml" id="server"/> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
22 будет обрабатываться тот или иной запрос. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
23 См. также “<link doc="request_processing.xml"/>”. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
24 Имена могут быть заданы точно, с помощью маски или регулярного |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
25 выражения: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
26 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
27 <programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
28 server { |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
29 listen 80; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
30 server_name example.org www.example.org; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
31 ... |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
32 } |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
33 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
34 server { |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
35 listen 80; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
36 server_name *.example.org; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
37 ... |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
38 } |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
39 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
40 server { |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
41 listen 80; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
42 server_name mail.*; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
43 ... |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
44 } |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
45 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
46 server { |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
47 listen 80; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
48 server_name ~^(?<user>.+)\.example\.net$; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
49 ... |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
50 } |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
51 </programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
52 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
53 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
54 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
55 При поиске виртуального сервера по имени, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
56 если имени соответствует несколько из указанных вариантов, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
57 например, одновременно подходят и имя с маской, и регулярное выражение, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
58 будет выбран первый подходящий вариант в следующем порядке приоритета: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
59 <list type="enum"> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
60 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
61 <listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
62 точное имя |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
63 </listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
64 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
65 <listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
66 самое длинное имя с маской в начале, например |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
67 “<literal>*.example.org</literal>” |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
68 </listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
69 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
70 <listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
71 самое длинное имя с маской в конце, например “<literal>mail.*</literal>” |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
72 </listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
73 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
74 <listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
75 первое подходящее регулярное выражение |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
76 (в порядке следования в конфигурационном файле) |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
77 </listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
78 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
79 </list> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
80 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
81 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
82 </section> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
83 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
84 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
85 <section id="wildcard_names" |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
86 name="Имена с масками"> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
87 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
88 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
89 Имя с маской может содержать звёздочку (“<literal>*</literal>”) только в начале |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
90 или в конце имени, и только на границе, определяемой точкой. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
91 Имена “<literal>www.*.example.org</literal>” и |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
92 “<literal>w*.example.org</literal>” являются некорректными, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
93 но их можно задать с помощью регулярных выражений, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
94 например, “<literal>~^www\..+\.example\.org$</literal>” и |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
95 “<literal>~^w.*\.example\.org$</literal>”. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
96 Звёздочка может соответствовать нескольким частям имени. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
97 Имени с маской “<literal>*.example.org</literal>” соответствует не только |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
98 <literal>www.example.org</literal>, но и |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
99 <literal>www.sub.example.org</literal>. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
100 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
101 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
102 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
103 Специальное имя с маской вида “<literal>.example.org</literal>” |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
104 соответствует как точному имени “<literal>example.org</literal>”, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
105 так и маске “<literal>*.example.org</literal>”. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
106 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
107 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
108 </section> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
109 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
110 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
111 <section id="regex_names" |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
112 name="Имена, заданные регулярными выражениями"> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
113 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
114 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
115 Регулярные выражения, используемые в nginx, совместимы |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
116 с используемыми в языке программирования Perl (PCRE). |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
117 Имя сервера, заданное регулярным выражением, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
118 должно начинаться с символа тильды: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
119 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
120 <programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
121 server_name ~^www\d+\.example\.net$; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
122 </programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
123 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
124 в противном случае оно будет рассматриваться как точное, или же, если |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
125 выражение содержит звёздочку (“<literal>*</literal>”), то как имя с маской |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
126 (и, скорее всего, некорректное). |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
127 Не забывайте ставить специальные символы начала (“<literal>^</literal>”) |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
128 и конца (“<literal>$</literal>”) строки. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
129 По синтаксису они не требуются, но логически они могут быть нужны. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
130 Также заметьте, что все точки в доменных именах должны быть экранированы |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
131 символом обратной косой черты. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
132 Регулярное выражение, содержащее символы “<literal>{</literal>” |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
133 и “<literal>}</literal>”, необходимо экранировать: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
134 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
135 <programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
136 server_name "~^(?<name>\w\d<b>{</b>1,3<b>}</b>+)\.example\.net$"; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
137 </programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
138 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
139 иначе nginx откажется запускаться и выдаст сообщение об ошибке: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
140 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
141 <programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
142 directive "server_name" is not terminated by ";" in ... |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
143 </programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
144 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
145 К именованному выделению в регулярном выражении можно впоследствии |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
146 обратиться через переменную: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
147 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
148 <programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
149 server { |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
150 server_name ~^(www\.)?(<b>?<domain></b>.+)$; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
151 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
152 location / { |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
153 root /sites/<b>$domain</b>; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
154 } |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
155 } |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
156 </programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
157 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
158 Библиотека PCRE поддерживает именованные выделения, используя следующий |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
159 синтаксис: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
160 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
161 <table note="yes"> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
162 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
163 <tr> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
164 <td><literal>?<<value>name</value>></literal></td> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
165 <td>Совместимый с Perl 5.10 синтаксис, поддерживается начиная с PCRE-7.0</td> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
166 </tr> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
167 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
168 <tr> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
169 <td><literal>?'<value>name</value>'</literal></td> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
170 <td>Совместимый с Perl 5.10 синтаксис, поддерживается начиная с PCRE-7.0</td> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
171 </tr> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
172 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
173 <tr> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
174 <td><literal>?P<<value>name</value>></literal></td> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
175 <td>Python-совместимый синтаксис, поддерживается начиная с PCRE-4.0</td> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
176 </tr> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
177 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
178 </table> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
179 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
180 Если nginx отказывается запускаться и выдаёт сообщение об ошибке: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
181 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
182 <programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
183 pcre_compile() failed: unrecognized character after (?< in ... |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
184 </programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
185 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
186 то это значит, что используется старая версия библиотеки PCRE и следует |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
187 вместо этого попробовать синтаксис |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
188 “<literal>?P<<value>name</value>></literal>”. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
189 Также можно использовать нумерованные выделения: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
190 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
191 <programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
192 server { |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
193 server_name ~^(www\.)?(.+)$; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
194 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
195 location / { |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
196 root /sites/<b>$2</b>; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
197 } |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
198 } |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
199 </programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
200 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
201 Однако такое использование должно ограничиваться простыми случаями как в |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
202 примере выше, поскольку нумерованные выделения легко могут быть перезаписаны. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
203 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
204 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
205 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
206 </section> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
207 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
208 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
209 <section id="miscellaneous_names" |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
210 name="Прочие имена"> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
211 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
212 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
213 Некоторые имена имеют специальное значение. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
214 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
215 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
216 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
217 Если необходимо обрабатывать запросы без поля <header>Host</header> в заголовке |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
218 в блоке <link doc="ngx_http_core_module.xml" id="server"/>, который не |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
219 является сервером по умолчанию, следует указать пустое имя: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
220 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
221 <programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
222 server { |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
223 listen 80; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
224 server_name example.org www.example.org ""; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
225 ... |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
226 } |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
227 </programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
228 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
229 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
230 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
231 Если директива |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
232 <link doc="ngx_http_core_module.xml" id="server_name"/> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
233 не задана в блоке <link doc="ngx_http_core_module.xml" id="server"/>, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
234 то nginx будет использовать пустое имя в качестве имени сервера. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
235 <note> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
236 Версии nginx вплоть до 0.8.48 в этом случае использовали имя хоста (hostname) |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
237 машины в качестве имени сервера. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
238 </note> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
239 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
240 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
241 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
242 Если имя сервера задано как “<literal>$hostname</literal>” (0.9.4), то |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
243 используется имя хоста (hostname) машины. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
244 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
245 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
246 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
247 Если в запросе вместо имени сервера указан IP-адрес, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
248 то поле <header>Host</header> заголовка запроса будет содержать |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
249 IP-адрес, и запрос можно обработать, используя IP-адрес как имя сервера: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
250 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
251 <programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
252 server { |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
253 listen 80; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
254 server_name example.org |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
255 www.example.org |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
256 "" |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
257 <b>192.168.1.1</b> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
258 ; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
259 ... |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
260 } |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
261 </programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
262 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
263 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
264 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
265 В примерах конфигурации серверов, обрабатывающих все запросы, встречается |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
266 странное имя “<literal>_</literal>”: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
267 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
268 <programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
269 server { |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
270 listen 80 default_server; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
271 server_name _; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
272 return 444; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
273 } |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
274 </programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
275 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
276 Оно не является каким-то особенным, это просто одно из множества |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
277 некорректных доменных имён, которые никогда не пересекутся ни с одним из |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
278 реальных имён. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
279 С тем же успехом можно использовать имена типа “<literal>--</literal>” |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
280 и “<literal>!@#</literal>”. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
281 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
282 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
283 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
284 Версии nginx вплоть до 0.6.25 поддерживали специальное имя |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
285 “<literal>*</literal>”, которое многими неверно воспринималось как |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
286 имя сервера для обработки всех запросов. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
287 Оно никогда так не работало, и не работало как имя с маской. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
288 Это имя действовало так же, как сейчас действует директива |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
289 <link doc="ngx_http_core_module.xml" id="server_name_in_redirect"/>. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
290 Специальное имя “<literal>*</literal>” объявлено устаревшим, а вместо него |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
291 следует использовать директиву |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
292 <link doc="ngx_http_core_module.xml" id="server_name_in_redirect"/>. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
293 Заметьте, что с помощью директивы |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
294 <link doc="ngx_http_core_module.xml" id="server_name"/> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
295 нельзя задать ни имя сервера для обработки всех запросов, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
296 ни сервер по умолчанию. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
297 Это является свойством директивы |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
298 <link doc="ngx_http_core_module.xml" id="listen"/>, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
299 а не |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
300 <link doc="ngx_http_core_module.xml" id="server_name"/>. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
301 См. также “<link doc="request_processing.xml"/>”. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
302 Можно настроить серверы, слушающие на портах *:80 и *:8080, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
303 и указать, что один из них будет сервером по умолчанию для порта *:8080, |
647
00972444baa7
Fixed tab indentation and replaced hyphen with proper space and dash.
Vladimir Homutov <vl@nginx.com>
parents:
645
diff
changeset
|
304 а другой — для порта *:80: |
645
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
305 <programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
306 server { |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
307 listen 80; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
308 listen 8080 default_server; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
309 server_name example.net; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
310 ... |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
311 } |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
312 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
313 server { |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
314 listen 80 default_server; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
315 listen 8080; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
316 server_name example.org; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
317 ... |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
318 } |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
319 </programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
320 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
321 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
322 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
323 </section> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
324 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
325 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
326 <section id="optimization" |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
327 name="Оптимизация"> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
328 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
329 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
330 Точные имена, имена с масками, начинающиеся со звёздочки, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
331 и имена с масками, заканчивающиеся на звёздочку, хранятся |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
332 в трёх хэш-таблицах, привязанных к слушающим портам. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
333 Размеры хэш-таблиц оптимизируются на фазе конфигурации таким образом, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
334 что имя может быть найдено с минимальным числом непопаданий в кэш процессора. |
659
77a3314c74a7
Avoid the uses of second person.
Ruslan Ermilov <ru@nginx.com>
parents:
647
diff
changeset
|
335 Подробнее настройка хэш-таблиц обсуждается в отдельном |
77a3314c74a7
Avoid the uses of second person.
Ruslan Ermilov <ru@nginx.com>
parents:
647
diff
changeset
|
336 <link doc="../hash.xml">документе</link>. |
645
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
337 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
338 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
339 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
340 В первую очередь имя ищется в хэш-таблице точных имён. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
341 Если имя не было найдено, то имя ищется в хэш-таблице имён с масками, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
342 начинающихся со звёздочки. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
343 Если и там поиск не дал результата, то имя ищется в хэш-таблице имён с масками, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
344 оканчивающихся на звёздочку. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
345 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
346 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
347 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
348 Поиск в хэш-таблице имён с масками медленнее, чем поиск в хэш-таблице точных |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
349 имён, поскольку имена сравниваются по доменным частям. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
350 Заметьте, что специальное имя с маской вида “<literal>.example.org</literal>” |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
351 хранится в хэш-таблице имён с масками, а не в хэш-таблице точных имён. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
352 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
353 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
354 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
355 Регулярные выражения проверяются последовательно, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
356 а значит являются самым медленным и плохо масштабируемым методом. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
357 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
358 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
359 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
360 По вышеизложенным причинам предпочтительнее использовать точные имена, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
361 где это только возможно. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
362 Например, если к серверу наиболее часто обращаются по именам |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
363 <literal>example.org</literal> и <literal>www.example.org</literal>, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
364 то эффективнее будет указать их явно: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
365 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
366 <programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
367 server { |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
368 listen 80; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
369 server_name example.org www.example.org *.example.org; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
370 ... |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
371 } |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
372 </programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
373 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
374 нежели чем использовать упрощённую форму: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
375 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
376 <programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
377 server { |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
378 listen 80; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
379 server_name .example.org; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
380 ... |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
381 } |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
382 </programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
383 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
384 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
385 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
386 Если задано большое число имён серверов, либо заданы необычно |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
387 длинные имена, возможно потребуется скорректировать значения директив |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
388 <link doc="ngx_http_core_module.xml" id="server_names_hash_max_size"/> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
389 и <link doc="ngx_http_core_module.xml" id="server_names_hash_bucket_size"/> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
390 на уровне <i>http</i>. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
391 Значение по умолчанию директивы |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
392 <link doc="ngx_http_core_module.xml" id="server_names_hash_bucket_size"/> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
393 может быть равно 32, 64, либо другой величине, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
394 в зависимости от размера строки кэша процессора. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
395 Если значение по умолчанию равно 32 и имя сервера задано как |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
396 “<literal>too.long.server.name.example.org</literal>”, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
397 то nginx откажется запускаться и выдаст сообщение об ошибке: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
398 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
399 <programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
400 could not build the server_names_hash, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
401 you should increase server_names_hash_bucket_size: 32 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
402 </programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
403 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
404 В этом случае следует увеличить значение директивы до следующей степени двойки: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
405 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
406 <programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
407 http { |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
408 server_names_hash_bucket_size 64; |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
409 ... |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
410 </programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
411 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
412 Если задано большое число имён серверов, то будет выдано другое |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
413 сообщение об ошибке: |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
414 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
415 <programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
416 could not build the server_names_hash, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
417 you should increase either server_names_hash_max_size: 512 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
418 or server_names_hash_bucket_size: 32 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
419 </programlisting> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
420 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
421 В таком случае сначала следует попробовать установить |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
422 <link doc="ngx_http_core_module.xml" id="server_names_hash_max_size"/> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
423 в величину, близкую к числу имён серверов, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
424 и только если это не поможет |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
425 или время запуска nginx станет неприемлемо большим, следует попытаться увеличить |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
426 <link doc="ngx_http_core_module.xml" id="server_names_hash_bucket_size"/>. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
427 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
428 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
429 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
430 Если сервер является единственным сервером для слушающего порта, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
431 то nginx не будет проверять имена сервера вообще (а также не будет |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
432 строить хэш-таблицы для слушающего порта). |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
433 За одним исключением: если имя сервера задано регулярным выражением |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
434 с выделениями, то nginx’у придётся выполнить это выражение, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
435 чтобы получить значения выделений. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
436 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
437 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
438 </section> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
439 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
440 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
441 <section id="compatibility" |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
442 name="Совместимость"> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
443 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
444 <para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
445 <list type="bullet"> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
446 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
447 <listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
448 Специальное имя сервера “<literal>$hostname</literal>” поддерживается начиная с |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
449 версии 0.9.4. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
450 </listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
451 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
452 <listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
453 Имя сервера по умолчанию является пустой строкой “” начиная с версии 0.8.48. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
454 </listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
455 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
456 <listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
457 Именованные выделения в именах серверов, заданных с помощью регулярных |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
458 выражений, поддерживаются начиная с версии 0.8.25. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
459 </listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
460 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
461 <listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
462 Выделения в именах серверов, заданных с помощью регулярных выражений, |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
463 поддерживаются начиная с версии 0.7.40. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
464 </listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
465 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
466 <listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
467 Пустое имя сервера “” поддерживается начиная с версии 0.7.12. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
468 </listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
469 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
470 <listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
471 В качестве первого имени сервера можно задать маску или регулярное выражение |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
472 начиная с версии 0.6.25. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
473 </listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
474 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
475 <listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
476 Регулярные выражения в имени сервера поддерживаются начиная с версии 0.6.7. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
477 </listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
478 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
479 <listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
480 Имена с маской вида <literal>example.*</literal> поддерживаются начиная |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
481 с версии 0.6.0. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
482 </listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
483 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
484 <listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
485 Специальная форма имени вида <literal>.example.org</literal> поддерживается |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
486 начиная с версии 0.3.18. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
487 </listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
488 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
489 <listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
490 Имена с маской вида <literal>*.example.org</literal> поддерживаются начиная |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
491 с версии 0.1.13. |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
492 </listitem> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
493 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
494 </list> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
495 </para> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
496 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
497 </section> |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
498 |
bb450e295ca2
Translated "Server names" into Russian and slightly changed original layout.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
499 </article> |