Nginx -- nginx. conf 프로필 상세 설명
41721 단어 nginx
1 #
2
3 # Nginx
4 #user nobody;
5
6 #nginx
7 # NginX SLL gzip, cpu , cpu
8 # cpu
9 worker_processes 1;
10
11 #
12 worker_rlimit_nofile 65535;S
13
14 #error_log x:/xxxxx/xxxx/log/error.log;
15 #error_log logs/error.log notice;
16 #error_log logs/error.log info;
17
18 #
19 pid logs/nginx.pid;
20
21 #Nginx , Nginx , , 。
22 events {
23 # worker process
24 # 65535
25 worker_connections 1024;
26 #woker_connections 65535;
27 # worker_processes worker_connections
28 # max_clients = worker_processes * worker_connections
29 # ,max_clients = worker_processes * worker_connections / 4
30 # 4,
31 # , Nginx Server :4 * 8000 = 32000
32 # worker_connections
33 # IO ,max_clients
34 # , 1GB 10
35 # 360M VPS :
36 # $ cat /proc/sys/fs/file-max
37 # 34336
38 # 32000 < 34336, ,
39 # ,worker_connections worker_processes
40 #
41 # CPU
42 # , , 。
43 # ulimit -SHn 65535
44 }
45
46
47
48
49 #Nginx HTTP , http
50 http {
51 #
52 include mime.types;
53 #
54 default_type application/octet-stream;
55 #
56 #charset utf-8;
57
58 # Nginx
59 #server_tokens off
60
61 #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
62 '$status $body_bytes_sent "$http_referer" '
63 '"$http_user_agent" "$http_x_forwarded_for"';
64
65 #access_log x:/xxxx/xxxx/log/access.log main;
66 #
67 #access_log off;
68 # ,sendfile nginx sendfile
69 # on,
70 # IO , off, I/O , 。
71 # : off。
72 sendfile on;
73 #tcp_nopush on;
74
75 #keepalive_timeout 0;
76 keepalive_timeout 60;
77
78
79 # gzip
80 #gzip on;
81 # , 。
82 #gzip_min_length 1000;
83 # Gzip
84 # expired--- Expires header ,
85 # auth ----- Authorization header,
86 #gzip_proxied expired no-cache no-store private auth;
87 #gzip_types text/plain application/xml;
88 #gzip_disable "MSIE [1-6].";
89
90 # 。 413
91 client_max_body_size 16m;
92 # 。
93 # ,
94 # 8k/16k
95 # ,
96 client_body_buffer_size 256k;
97 proxy_temp_file_write_size 128k;
98 proxy_temp_path x:/xxx/xxxxx/public;
99 #levels
100 #keys_zone
101 #inactive 1
102 #max_size
103 #proxy_cache_path x:/xxxx/xxx/cache levels=1:2 keys_zone=cache_one:256m inactive=2d max_size=300m;
104
105
106
107
108 upstream mywebapp_thin
109 {
110 # , IP 。
111 #IPv4 IPv6 , key。
112 # , 。
113 # , ,
114 # 。
115 # , IP upstream server 。
116 # ip
117 # , ,
118 # 。
119 #
120 # , 。
121 ip_hash;
122 #upstream ,weight , 。
123 #weigth , 。
124 # , ip down
125 #backup
126 server 127.0.0.1:3000;
127 server 127.0.0.1:3001 down;
128 }
129
130
131
132 #
133 server {
134 #
135 listen 80 default_server;
136 # localhost
137 # ,
138 # HTTP (Host header) Nginx Server{...}
139 # server ——。
140 # :
141 #1. ,
142 #2. , :*.exmple.com
143 #3. , :www.example.*
144 #4. 。
145 server_name localhost;
146
147 #
148 #charset koi8-r;
149
150 #rewrite_log on;
151
152 #
153 #access_log logs/host.access.log main;
154 #access_log x:/xxx/xxx/log/host.access.log;
155
156 root x:/xxx/xxx/public;
157
158
159
160 #
161 #location ~* ^/(images|javascripts|stylesheets|img)/
162 #location ~* .(gif|jpg|jpeg|png|bmp|swf)$
163 #{
164 # root x:/xx/xxx/public;
165 # access_log off;
166 # log_not_found off;
167 # expires max;
168
169 # key hash, KEY
170 # proxy_cache_key $host$uri$is_args$args;
171 # keys_zone
172 # proxy_cache cache_one;
173 #
174 # proxy_cache_valid 200 302 7d;
175 #
176 # proxy_cache_valid 301 3d;
177 # proxy_cache_valid any 1m;
178
179 # if (!-f $request_filename) {
180 # proxy_pass http://mywebapp_thin;
181 # break;
182 # }
183 #break;
184 #}
185
186 # URI
187 #
188 # ,
189 # “~”
190 # “~*”
191 # , ,
192 # , "/"
193 location / {
194 #
195 root x:/xxx/xxx/public;
196 #
197 index index.html index.htm;
198 if (!-f $request_filename) {
199 proxy_pass http://mywebapp_thin;
200 break;
201 }
202 proxy_redirect off;
203 proxy_set_header X-Real-IP $remote_addr;
204 # Web X-Forwarded-For IP
205 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
206 # , 。
207 proxy_set_header Host $host;
208 #
209 client_max_body_size 10m;
210 # ,
211 client_body_buffer_size 128k;
212 #nginx ( )
213 proxy_connect_timeout 90;
214 # ( )
215 proxy_send_timeout 90;
216 # , ( )
217 proxy_read_timeout 90;
218 # (nginx)
219 proxy_buffer_size 4k;
220 #proxy_buffers , 32k
221 proxy_buffers 4 32k;
222 # , 。
223 proxy_buffering on;
224 # (proxy_buffers*2)
225 proxy_busy_buffers_size 64k;
226 # , , upstream
227 proxy_temp_file_write_size 64k;
228
229 # key hash, KEY
230 # proxy_cache_key $host$uri$is_args$args;
231 # keys_zone
232 # proxy_cache cache_one;
233 #
234 # proxy_cache_valid 200 302 7d;
235 #
236 # proxy_cache_valid 301 3d;
237 # proxy_cache_valid any 1m;
238 }
239
240
241 # uri,
242 #error_page 404 /404.html;
243
244 # redirect server error pages to the static page /50x.html
245 #
246 #
247 error_page 500 502 503 504 /50x.html;
248 location = /50x.html {
249 root html;
250 }
251
252 # proxy the PHP scripts to Apache listening on 127.0.0.1:80
253 #
254 #location ~ .php$ {
255 # proxy_pass http://127.0.0.1;
256 #}
257
258 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
259 #
260 #location ~ .php$ {
261 # root html;
262 # fastcgi_pass 127.0.0.1:9000;
263 # fastcgi_index index.php;
264 # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
265 # include fastcgi_params;
266 #}
267
268 # deny access to .htaccess files, if Apache's document root
269 # concurs with nginx's one
270 #
271 #location ~ /.ht {
272 # deny all;
273 #}
274
275 #
276 #location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
277 #{
278 # expires 10d;
279 #}
280 #JS CSS
281 #location ~ .*.(js|css)?$
282 #{
283 # expires 1h;
284 #}
285
286 #FastCGI : , 。
287 fastcgi_connect_timeout 300;
288 fastcgi_send_timeout 300;
289 fastcgi_read_timeout 300;
290 fastcgi_buffer_size 64k;
291 fastcgi_buffers 4 64k;
292 fastcgi_busy_buffers_size 128k;
293 fastcgi_temp_file_write_size 128k;
294 }
295
296
297 # another virtual host using mix of IP-, name-, and port-based configuration
298 #
299 #server {
300 # listen 8000;
301 # listen somename:8080;
302 # server_name somename alias another.alias;
303
304 # location / {
305 # root html;
306 # index index.html index.htm;
307 # }
308 #}
309
310
311 # HTTPS server
312 #
313 #server {
314 # listen 443 ssl;
315 # server_name localhost;
316
317 # ssl_certificate cert.pem;
318 # ssl_certificate_key cert.key;
319
320 # ssl_session_cache shared:SSL:1m;
321 # ssl_session_timeout 5m;
322
323 # ssl_ciphers HIGH:!aNULL:!MD5;
324 # ssl_prefer_server_ciphers on;
325
326 # location / {
327 # root html;
328 # index index.html index.htm;
329 # }
330 #}
331
332 }
About this: http://www.ha97.com/5194.html
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
간단! Certbot을 사용하여 웹 사이트를 SSL(HTTPS)화하는 방법초보자가 인프라 주위를 정돈하는 것은 매우 어렵습니다. 이번은 사이트를 간단하게 SSL화(HTTP에서 HTTPS통신)로 변경하는 방법을 소개합니다! 이번에는 소프트웨어 시스템 Nginx CentOS7 의 환경에서 S...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.