Discuz Avatar Program parsing result Cache

Source: Internet
Author: User


The Forum avatar is dynamic, for example: Http://xxx.xxx.xxx/avatar.php?uid=xxx&size=big

Each user's avatar file has big, middle, small three, and in different scenes to call different sizes of Avatar pictures, such as posts, personal settings, avatar editing, landing and so on, virtually increased the work pressure between Nginx and PHP, If you can cache this parsing result, it will reduce the communication pressure between Nginx and PHP, which will reduce the system CPU utilization.


To test the Nginx cache function, configure the following:


HTTP domain Additions

Fastcgi_cache_path/xxxcache levels=1:2 keys_zone=cgicache:30m inactive=1d max_size=10g;


Server domain Additions

Location ~* ^/avatar.php?. *$ {
Add_header X-CACHE-CFC "$upstream _cache_status-$upstream _response_time";
Fastcgi_temp_path/xxxtemp;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include Fastcgi_params;
Fastcgi_cache Cgicache;
Fastcgi_cache_valid 301 302 1h;
Fastcgi_cache_min_uses 1;
Fastcgi_cache_use_stale error timeout Invalid_header http_500;
Fastcgi_cache_key $host $request_uri;
}


By verifying that the cache file is generated successfully, the HTTP request is changed to miss, hit, and so on.




This article is from the "Bodhi" blog, so be sure to keep this source http://zhangxingnan.blog.51cto.com/3241217/1619053

Discuz Avatar Program parsing result Cache

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.