Mercurial > hg > nginx-site
comparison xml/ru/docs/http/ngx_http_js_module.xml @ 2190:dfc49994218c
Updated example in HTTP njs module.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Tue, 19 Jun 2018 20:43:33 +0300 |
parents | 523dc4cc8745 |
children | 5cacd6fffade |
comparison
equal
deleted
inserted
replaced
2189:23cfb62121d1 | 2190:dfc49994218c |
---|---|
7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> | 7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
8 | 8 |
9 <module name="Модуль ngx_http_js_module" | 9 <module name="Модуль ngx_http_js_module" |
10 link="/ru/docs/http/ngx_http_js_module.html" | 10 link="/ru/docs/http/ngx_http_js_module.html" |
11 lang="ru" | 11 lang="ru" |
12 rev="13"> | 12 rev="14"> |
13 | 13 |
14 <section id="summary"> | 14 <section id="summary"> |
15 | 15 |
16 <para> | 16 <para> |
17 Модуль <literal>ngx_http_js_module</literal> позволяет задавать | 17 Модуль <literal>ngx_http_js_module</literal> позволяет задавать |
31 | 31 |
32 <section id="example" name="Пример конфигурации"> | 32 <section id="example" name="Пример конфигурации"> |
33 | 33 |
34 <para> | 34 <para> |
35 <example> | 35 <example> |
36 js_include http.js; | 36 load_module modules/ngx_http_js_module.so; |
37 ... | |
37 | 38 |
38 js_set $foo foo; | 39 http { |
39 js_set $summary summary; | 40 js_include http.js; |
40 | 41 |
41 server { | 42 js_set $foo foo; |
42 listen 8000; | 43 js_set $summary summary; |
43 | 44 |
44 location / { | 45 server { |
45 add_header X-Foo $foo; | 46 listen 8000; |
46 js_content baz; | |
47 } | |
48 | 47 |
49 location /summary { | 48 location / { |
50 return 200 $summary; | 49 add_header X-Foo $foo; |
50 js_content baz; | |
51 } | |
52 | |
53 location /summary { | |
54 return 200 $summary; | |
55 } | |
56 | |
57 location /hello { | |
58 js_content hello; | |
59 } | |
51 } | 60 } |
52 } | 61 } |
53 </example> | 62 </example> |
54 </para> | 63 </para> |
55 | 64 |
94 r.send("nginx"); | 103 r.send("nginx"); |
95 r.send("java"); | 104 r.send("java"); |
96 r.send("script"); | 105 r.send("script"); |
97 | 106 |
98 r.finish(); | 107 r.finish(); |
108 } | |
109 | |
110 function hello(r) { | |
111 r.return(200, "Hello world!"); | |
99 } | 112 } |
100 </example> | 113 </example> |
101 </para> | 114 </para> |
102 | 115 |
103 </section> | 116 </section> |