Skip to content

Instantly share code, notes, and snippets.

@matsimitsu
Created July 11, 2015 14:03
Show Gist options
  • Save matsimitsu/da7669b25d4915f3da57 to your computer and use it in GitHub Desktop.
Save matsimitsu/da7669b25d4915f3da57 to your computer and use it in GitHub Desktop.
NGINX cache proxy
http {
proxy_cache_path /tmp/cache levels=1:2 keys_zone=photo-cache:8m max_size=5000m inactive=43829m;
proxy_cache_key $host$uri$is_args$args;
server {
proxy_cache photo-cache;
listen 80;
server_name cdn.matsimitsu.com;
access_log logs/cdn.access.log;
location / {
expires 365d;
add_header Pragma public;
add_header Cache-Control "public";
add_header X-Proxy-Cache $upstream_cache_status;
proxy_cache_valid 200 43829m;
proxy_pass http://localhost:7000;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment