Answer the question
In order to leave comments, you need to log in
How to configure static caching in nginx?
You need to set up a server that distributes images. It should take images and cache them with http://1.2.3.4
. Current config:
proxy_cache_path /var/www/my_cache levels=2:2:2 keys_zone=STATIC:100m inactive=1d;
server {
listen 80 default_server;
server_name _;
location / {
proxy_pass http://1.2.3.4;
proxy_buffering on;
proxy_cache STATIC;
proxy_cache_valid 200 100d;
}
}
http://1.2.3.4
even if it is in the cache. The same situation if I open the image in another browser. proxy_ignore_headers X-Accel-Expires;
proxy_ignore_headers Set-Cookie;
proxy_ignore_headers Cache-Control;
andproxy_hide_header Cache-Control;
proxy_hide_header Set-Cookie;
Answer the question
In order to leave comments, you need to log in
Maybe not quite on the topic, but Varnish has similar solutions .
This is just a caching server and its work can be easily configured in tandem with nginx .
Thematic articles are here
https://ruhighload.com/varnish
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question