Ticket #1587: nginx.conf

File nginx.conf, 4.0 KB (added by dyeldandi@…, 8 years ago)

nginx configuration

Line 
1user root root;
2worker_processes 8;
3worker_rlimit_nofile 8192;
4worker_priority -5;
5
6load_module modules/ngx_http_image_filter_module.so;
7
8error_log /var/log/nginx/error.resizer.local.log error;
9pid /var/run/nginx.resizer.local.pid;
10
11events {
12 worker_connections 4096;
13 use epoll;
14}
15
16http {
17 resolver 127.0.0.1;
18 include mime.types;
19 default_type application/octet-stream;
20
21 log_format geolog '$remote_addr $upstream_addr [$time_local] "$request" '
22 '$status $body_bytes_sent "$http_referer" '
23 '"$http_user_agent" "$http_x_forwarded_for" '
24 '"$upstream_cache_status" "$geo_code" ';
25
26 access_log off;
27 include koi-utf;
28
29 geo $geo_code {
30 ranges;
31 default XX/0000;
32 include geo_code.conf;
33 }
34
35
36 sendfile on;
37 tcp_nopush on;
38 tcp_nodelay on;
39
40 keepalive_timeout 15;
41 client_max_body_size 32M;
42
43 reset_timedout_connection on;
44 client_header_buffer_size 1k;
45 large_client_header_buffers 4 4k;
46 output_buffers 128 256k;
47 postpone_output 1460;
48 client_header_timeout 50;
49 client_body_timeout 3m;
50 send_timeout 3m;
51 client_body_buffer_size 16k;
52 proxy_buffers 8 256k;
53 proxy_busy_buffers_size 256k;
54 proxy_temp_file_write_size 256k;
55
56 gzip on;
57 gzip_disable "MSIE [1-6]\.(?!.*SV1)";
58 gzip_buffers 4 256k;
59 gzip_comp_level 5;
60 gzip_types text/plain text/xml text/css text/javascript application/x-javascript application/xml application/xhtml+xml application/rss+xml image/svg+xml;
61 gzip_vary on;
62
63 server_names_hash_max_size 1024;
64 server_names_hash_bucket_size 128;
65
66 proxy_temp_path /var/cache/nginx.resizer.local;
67
68 server {
69 server_name resizer.local;
70 listen 127.0.0.1:8889;
71
72 access_log /var/log/nginx/resizer.local.8889.access.log geolog;
73 error_log /var/log/nginx/resizer.local.8889.error.log error;
74
75 resolver 127.0.0.1;
76 resolver_timeout 1s;
77
78
79 secure_link_secret foobar;
80
81 error_page 403 404 415 500 502 503 504 = @404;
82
83
84 location ~ ^/s/(?<secure>[\w-]+)/(?<dhost>[^/]+)/(?<durl>.*)$ {
85
86 if ($secure_link = "") { return 404; }
87
88 proxy_pass http://$dhost/$durl$is_args$args;
89
90 image_filter size;
91 image_filter_buffer 32M;
92 image_filter_jpeg_quality 85;
93
94 }
95
96 location ~ ^/c/[^/]+/(\d+|-)x(\d+|-)/(?<dhost>[^/]+)/(?<durl>.*)$ {
97
98 set $width $1;
99 set $height $2;
100
101 if ($secure_link = "") { return 404; }
102
103 proxy_pass http://$dhost/$durl$is_args$args;
104
105 image_filter crop $width $height;
106 image_filter_buffer 32M;
107 image_filter_jpeg_quality 85;
108 }
109
110 location ~ ^/r/[^/]+/(\d+|-)x(\d+|-)/(?<dhost>[^/]+)/(?<durl>.*) {
111
112 set $width $1;
113 set $height $2;
114
115 if ($secure_link = "") { return 404; }
116
117 proxy_pass http://$dhost/$durl$is_args$args;
118
119 image_filter resize $width $height;
120 image_filter_buffer 32M;
121 image_filter_jpeg_quality 85;
122 }
123
124 location @404 { return 404; }
125 }
126
127
128}
129