: This article mainly introduces nginx as an example of browser cache configuration for image browsing. if you are interested in PHP tutorials, refer to it.
# Image viewing cacheproxy_cache_path/var/cache/nginx/imgCache levels = keys_zone = imgCache: 256 m inactive = 7d max_size = 0 m; server {listen 80; server_name img.xxxx.net; root/data/www/; location ~ \. (Jpg | jpeg | jp2 | png | gif | bmp | ico | wbmp | xbm | tiff) (/\ d *)? (/\ D *)? (\?. *)? $ {Proxy_pass http://127.0.0.1:8118 ; Proxy_cache imgCache; proxy_cache_key $ host $ uri; proxy_set_header host success; proxy_cache_valid 200 30d; running any 1 m; expires 30d;} access_log/var/log/nginx/img_cache.log main; error_log/var/log/nginx/img_cache.log.err debug ;}server {listen 8118; server_name inner.img.xxxx.net; root/data/www/; location ~ \. (Jpg | jpeg | jp2 | png | gif | bmp | ico | wbmp | xbm | tiff) (/\ d *)? (/\ D *)? (\?. *)? $ {Fastcgi_pass unix:/var/run/php-cgi.sock; fastcgi_index index. php; fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name; include fastcgi_params; rewrite ^ /(. *) $/app/image/index. php? Mod = download break; expires 7d;} access_log/var/log/nginx/img_download.log main; error_log/var/log/nginx/img_download.log.err debug ;}
The above introduces nginx as an example of browser cache configuration for image browsing, including some content. if you are interested in PHP tutorials, please help.