Nginx as a picture browsing front-end cache configuration sample

Source: Internet
Author: User
#图片浏览cache proxy_cache_path/var/cache/nginx/imgcache levels=2:2:2 keys_zone=imgcache:256m inactive=7d max_size=0m;
    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 inner.img.xxxx.com;
        Proxy_cache_valid 30d;
        Proxy_cache_valid any 1m;
    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;
 }

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.