Skip to content

Instantly share code, notes, and snippets.

@vamdt
Created August 3, 2016 08:05
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 vamdt/fd3e95d33dadbfde77fe954bbcb5ad55 to your computer and use it in GitHub Desktop.
Save vamdt/fd3e95d33dadbfde77fe954bbcb5ad55 to your computer and use it in GitHub Desktop.
nginx proxy cache configuration
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding 'gzip';
client_max_body_size 100m;
client_body_buffer_size 256k;
proxy_connect_timeout 60;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_buffer_size 512k;
proxy_buffers 8 512k;
proxy_busy_buffers_size 512k;
proxy_temp_file_write_size 512k;index index.html;
upstream website {
server 192.168.1.100;
server 192.168.1.101;
}
proxy_cache_path /path/to/cache/dir levels=1:2 keys_zone=website:100m inactive=10d max_size=3g;
server {
listen 80;
server_name website.example.com;
index index.html;
location / {
proxy_cache apiproxy;
proxy_ignore_headers Expires Cache-Control;
proxy_cache_valid 200 302 304 10d;
proxy_cache_key $host$uri$is_args$args;
include proxy.conf;
proxy_pass http://website;
expires 10d;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment