Proxy and cache external resource with nginx
proxy_cache_path /home/nginx levels=1:2 keys_zone=CACHE:50m max_size=12G inactive=30d; server { server_name example.com; location / { proxy_cache_key "$uri"; proxy_pass https://$path$is_args$args; resolver 8.8.8.8; proxy_cache CACHE; access_log off; expires max; add_header X-Proxy-Cache $upstream_cache_status; proxy_set_header Referer ""; proxy_cache_valid 200 30d; proxy_cache_valid 403 10m; proxy_cache_valid 404 10m; proxy_ssl_server_name on; proxy_ssl_name $proxy_host; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot }
15 декабря 2023, 12:59