不会贴代码 还不能编辑了
upstream gstatic {
server
www.gstatic.com;
}
proxy_buffering on;
etag on;
proxy_temp_file_write_size 1024k;
proxy_temp_path /var/cache/nginx/temp;
proxy_cache_path /var/cache/nginx/cache levels=1:2 keys_zone=cache_one:100m inactive=19d max_size=5g;
server {
listen 80;
server_name
gstatic.178.re;
resolver 8.8.8.8;
location / {
sub_filter "
www.gstatic.com" "
gstatic.178.re";
sub_filter "https" "http";
sub_filter_once off;
sub_filter_types *;
proxy_pass_header Server;
proxy_set_header Host
www.gstatic.com;
proxy_set_header Accept-Encoding '';
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://gstatic;
proxy_cache cache_one;
proxy_cache_valid 200 304 365d;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_min_uses 1;
expires max;
proxy_cache_revalidate on;
add_header X-Proxy-Cache $upstream_cache_status;
add_header Cache-Control "public";
if_modified_since before;
}
}