Skip to content

Instantly share code, notes, and snippets.

@xiaohuilam
Created August 3, 2015 15:11
Show Gist options
  • Save xiaohuilam/5296f2fdab4dbf5145bb to your computer and use it in GitHub Desktop.
Save xiaohuilam/5296f2fdab4dbf5145bb to your computer and use it in GitHub Desktop.
nginx better proxy cache configuration
map $uri $store_uri {
default $uri;
'' '/index.html';
'/' '/index.html';
}
server {
listen 443 ssl spdy;
server_name www.it68.com.cn;
ssl on;
ssl_certificate /home/ssl/it68.crt;
ssl_certificate_key /home/ssl/it68.pem;
ssl_prefer_server_ciphers on;
ssl_ciphers HIGH:!MD5:!aNULL:!EDH:!CAMELLIA:!PSK:!SRP;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
client_max_body_size 8m;
location / {
expires 60s;
trim on;
trim_js on;
trim_css on;
charset utf-8;
default_type text/html;
#index index.html;
root /var/www/tmp/;
error_page 404 = @fetch;
error_page 403 = @fetch;
subs_filter http://www.it68.com.cn https://www.it68.com.cn ir;
#add_header 'Content-Encoding' 'gzip';
gzip on;
gzip_types text/plain application/xml;
gzip_min_length 1000;
gzip_proxied no-cache no-store private expired auth;
etag on;
}
location @fetch {
internal;
proxy_ignore_headers 'Set-Cookie';
proxy_hide_header 'X-Tumblr-Pixel';
proxy_hide_header 'X-Tumblr-Pixel-0';
proxy_hide_header 'X-Tumblr-Pixel-1';
proxy_hide_header 'X-Tumblr-User';
proxy_hide_header 'X-UA-Device';
proxy_hide_header 'X-UA-Compatible';
proxy_hide_header 'Link';
proxy_hide_header 'P3P';
proxy_hide_header 'CF-RAY';
proxy_hide_header 'CF-Cache-Status';
proxy_hide_header 'Date';
proxy_set_header 'Cookie' __cfduid=d551f349d3baf701b7c8d2da2b48ffb6e1438576503;
proxy_set_header 'Accept-Encoding' '';
proxy_set_header 'User-Agent' 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36';
proxy_set_header 'Host' 'www.it68.com.cn';
proxy_pass http://180.163.189.0:80;
proxy_store /var/www/tmp${store_uri};
proxy_store_access user:rw group:rw all:rw;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment