1
2
3
4
5
|
location ~* ^.+\.(js|ico|gif|jpg|jpeg|png|html|htm)$ {
log_not_found off;
access_log off;
expires 7d;
}
|
1
2
3
4
5
6
7
8
9
10
|
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|html|htm|css)$ {
log_not_found off;
expires 7d ;
access_log off;
proxy_store on;
proxy_store_access user:rw group:rw all:rw;
if
( !-e $request_filename) {
proxy_pass http:
//img
.example.com
}
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
http {
,,,,,
proxy_cache_path
/var/cache/nginx/cache
levels=1:2 keys_zone=imgcache:100m inactive=1d max_size=10g;
server {
........
location ~* ^.+\.(js|ico|gif|jpg|jpeg|png|html|htm)$ {
log_not_found off;
access_log off;
expires 7d;
proxy_pass http:
//img
.example.com ;
proxy_cache imgcache;
proxy_cache_valid 200 302 1d;
proxy_cache_valid 404 10m;
proxy_cache_valid any 1h;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
}
}
}
|