Nginx Config HTTP strong cache

Source: Internet
Author: User

Server {Listen80;    server_name tirion.me www.tirion.me; # Note that these lines is originally from the"Location/"Block Root/home/www/wordpress;index index.php index.html index.htm; Location/{try_files $uri $uri/=404; } error_page404/404.html;    Error_page 502 503 504/50x.html; Location =/50x.html {root/usr/share/nginx/html; } Location~\.php$ {try_files $uri=404; Fastcgi_pass Unix:/var/run/php-fpm/php-Fpm.sock;        Fastcgi_index index.php;        Fastcgi_param script_filename $document _root$fastcgi_script_name;    Include Fastcgi_params; # config HTTP strong cache static file, return to location via Response header~ .*\. (gif|jpg|jpeg|png|bmp|swf|js|CSS) $ {expires 3d; }}

The Response header informs the browser to cache the Gif|jpg|jpeg|png|bmp|swf|js|css file for 3 days

After browser access, you can see it in the Response Header.

cache-control:max-age=31536000 These files are not re-fetched from the server, but are fetched directly from the browser's cache, improving network performance.

Nginx Config HTTP strong 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.