Skip to content

Instantly share code, notes, and snippets.

@Archieeeeee
Created March 10, 2016 01:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Archieeeeee/b27a46b62775fb188c07 to your computer and use it in GitHub Desktop.
Save Archieeeeee/b27a46b62775fb188c07 to your computer and use it in GitHub Desktop.
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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment