Mercurial > hg > nginx-site
comparison xml/en/docs/example.xml @ 1640:442efe0268db
Translated example configuration into English.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Thu, 14 Jan 2016 13:20:19 +0300 |
parents | xml/ru/docs/example.xml@202f1d671398 |
children | 5cacd6fffade |
comparison
equal
deleted
inserted
replaced
1639:202f1d671398 | 1640:442efe0268db |
---|---|
1 <!-- | |
2 Copyright (C) Igor Sysoev | |
3 Copyright (C) Nginx, Inc. | |
4 --> | |
5 | |
6 <!DOCTYPE article SYSTEM "../../../dtd/article.dtd"> | |
7 | |
8 <article name="Example nginx configuration" | |
9 link="/en/docs/example.html" | |
10 lang="en" | |
11 rev="2"> | |
12 | |
13 <section> | |
14 | |
15 <para> | |
16 An example site configuration that passes all requests to the backend except | |
17 images and requests starting with "/download/". | |
18 <programlisting> | |
19 user www www; | |
20 | |
21 worker_processes 2; | |
22 | |
23 pid /var/run/nginx.pid; | |
24 | |
25 # [ debug | info | notice | warn | error | crit ] | |
26 | |
27 error_log /var/log/nginx.error_log info; | |
28 | |
29 events { | |
30 worker_connections 2000; | |
31 | |
32 # use [ kqueue | epoll | /dev/poll | select | poll ]; | |
33 use kqueue; | |
34 } | |
35 | |
36 http { | |
37 | |
38 include conf/mime.types; | |
39 default_type application/octet-stream; | |
40 | |
41 | |
42 log_format main '$remote_addr - $remote_user [$time_local] ' | |
43 '"$request" $status $bytes_sent ' | |
44 '"$http_referer" "$http_user_agent" ' | |
45 '"$gzip_ratio"'; | |
46 | |
47 log_format download '$remote_addr - $remote_user [$time_local] ' | |
48 '"$request" $status $bytes_sent ' | |
49 '"$http_referer" "$http_user_agent" ' | |
50 '"$http_range" "$sent_http_content_range"'; | |
51 | |
52 client_header_timeout 3m; | |
53 client_body_timeout 3m; | |
54 send_timeout 3m; | |
55 <!-- | |
56 connection_pool_size 256; | |
57 --> | |
58 client_header_buffer_size 1k; | |
59 large_client_header_buffers 4 4k; | |
60 <!-- | |
61 request_pool_size 4k; | |
62 --> | |
63 gzip on; | |
64 gzip_min_length 1100; | |
65 gzip_buffers 4 8k; | |
66 gzip_types text/plain; | |
67 | |
68 output_buffers 1 32k; | |
69 postpone_output 1460; | |
70 | |
71 sendfile on; | |
72 tcp_nopush on; | |
73 tcp_nodelay on; | |
74 send_lowat 12000; | |
75 | |
76 keepalive_timeout 75 20; | |
77 | |
78 #lingering_time 30; | |
79 #lingering_timeout 10; | |
80 #reset_timedout_connection on; | |
81 | |
82 | |
83 server { | |
84 listen one.example.com; | |
85 server_name one.example.com www.one.example.com; | |
86 | |
87 access_log /var/log/nginx.access_log main; | |
88 | |
89 location / { | |
90 proxy_pass http://127.0.0.1/; | |
91 proxy_redirect off; | |
92 | |
93 proxy_set_header Host $host; | |
94 proxy_set_header X-Real-IP $remote_addr; | |
95 #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
96 | |
97 client_max_body_size 10m; | |
98 client_body_buffer_size 128k; | |
99 | |
100 client_body_temp_path /var/nginx/client_body_temp; | |
101 | |
102 proxy_connect_timeout 70; | |
103 proxy_send_timeout 90; | |
104 proxy_read_timeout 90; | |
105 proxy_send_lowat 12000; | |
106 | |
107 proxy_buffer_size 4k; | |
108 proxy_buffers 4 32k; | |
109 proxy_busy_buffers_size 64k; | |
110 proxy_temp_file_write_size 64k; | |
111 | |
112 proxy_temp_path /var/nginx/proxy_temp; | |
113 | |
114 charset koi8-r; | |
115 } | |
116 | |
117 error_page 404 /404.html; | |
118 | |
119 location /404.html { | |
120 root /spool/www; | |
121 } | |
122 | |
123 location /old_stuff/ { | |
124 rewrite ^/old_stuff/(.*)$ /new_stuff/$1 permanent; | |
125 } | |
126 | |
127 location /download/ { | |
128 | |
129 valid_referers none blocked server_names *.example.com; | |
130 | |
131 if ($invalid_referer) { | |
132 #rewrite ^/ http://www.example.com/; | |
133 return 403; | |
134 } | |
135 | |
136 #rewrite_log on; | |
137 | |
138 # rewrite /download/*/mp3/*.any_ext to /download/*/mp3/*.mp3 | |
139 rewrite ^/(download/.*)/mp3/(.*)\..*$ | |
140 /$1/mp3/$2.mp3 break; | |
141 | |
142 root /spool/www; | |
143 #autoindex on; | |
144 access_log /var/log/nginx-download.access_log download; | |
145 } | |
146 | |
147 location ~* \.(jpg|jpeg|gif)$ { | |
148 root /spool/www; | |
149 access_log off; | |
150 expires 30d; | |
151 } | |
152 } | |
153 } | |
154 </programlisting> | |
155 </para> | |
156 | |
157 </section> | |
158 | |
159 </article> |