Files
LEMPer/etc/nginx/includes/rules_staticfiles.conf
2019-07-23 00:53:07 +07:00

51 lines
1.6 KiB
Plaintext

## Directives to send expires headers and turn off 404 error logging for known static file.
# Designed to be included in any server {} block.
# Header setting for known static files.
location ~* \.(?:ico|ogg|ogv|3gp|gif|jpeg|jpg|png|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|rtf|rtx|txt|pdf|iso)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate, max-age=2592000";
access_log off;
log_not_found off;
}
# Header setting for js and css files.
location ~* \.(css|css3|htc|less|js|js2|js3|js4)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate, max-age=2592000";
access_log off;
log_not_found off;
}
# Header setting for font files.
location ~* \.(eot|svg|svgz|ttf|woff|woff2)$ {
expires max;
add_header Pragma "public";
add_header Cache-Control "public, must-revalidate, proxy-revalidate, max-age=2592000";
access_log off;
log_not_found off;
}
# Header setting rss/atom.
location ~* \.(?:rss|atom)$ {
expires 1d;
add_header Pragma "public";
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
access_log off;
log_not_found off;
}
# Dynamic thumbnail image
location ~* (timthumb|thumbs|image|images|img)\.php?src=.*\.(jpg|jpeg|png|gif).* {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate, max-age=2592000";
access_log off;
log_not_found off;
}
## DO NOT CACHE static .html file by default,
# it is causing an 403 error on WordPress permalink structure that include .html extension on the link.