Skip to content

Instantly share code, notes, and snippets.

@Cee
Created April 13, 2015 08:14
Show Gist options
  • Select an option

  • Save Cee/d8573e3afe5484a2e2e6 to your computer and use it in GitHub Desktop.

Select an option

Save Cee/d8573e3afe5484a2e2e6 to your computer and use it in GitHub Desktop.
Nginx 反代 Gravatar
proxy_cache_path /home/wwwroot/example.com/cache levels=1:2 keys_zone=gravatar:10m inactive=7d max_size=1g;
server
{
listen 80;
server_name example.com
location / {
proxy_cache gravatar;
proxy_cache_valid 200 302 1h;
proxy_cache_valid 404 1m;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_pass https://secure.gravatar.com;
proxy_set_header Host "secure.gravatar.com";
proxy_set_header Accept-Encoding "";
proxy_set_header User-Agent $http_user_agent;
}
access_log off; #access_log end
error_log /dev/null; #error_log end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment