Reverse Proxy with Caching

A Sample Nginx Reverse proxy configuration- an alternative to Varnish cache (kind of more simplistic)-

user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
 worker_connections 768;
 # multi_accept on;
}
http {
 proxy_cache_path /cache levels=1:2 keys_zone=STATIC:10m
 inactive=24h max_size=1g;
 server {
 location / {
 proxy_pass http://127.0.0.1:8080;
 proxy_set_header Host $host;
 proxy_cache STATIC;
 proxy_cache_valid 200 1d;
 proxy_cache_use_stale error timeout invalid_header updating
 http_500 http_502 http_503 http_504;
 }
 }
}
Share

Leave a Reply