Nginx as a browser cache configuration example

Source: Internet
Author: User
: 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.