Improve static files logic

This commit is contained in:
Ashley Rich 2015-11-20 16:12:30 +00:00
parent 77bc5ab452
commit 4ffe1a88cf
8 changed files with 42 additions and 50 deletions

View File

@ -1,22 +0,0 @@
# cache.appcache, your document html and data
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
expires -1;
}
# Feed
location ~* \.(?:rss|atom)$ {
expires 1h;
add_header Cache-Control "public";
}
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1y;
add_header Cache-Control "public";
}
# CSS and Javascript
location ~* \.(?:css|js)$ {
expires 1y;
add_header Cache-Control "public";
}

View File

@ -10,21 +10,3 @@ location ~ /\. {
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
# Don't record error/access logs for favicon.io.
location = /favicon.ico {
log_not_found off;
access_log off;
}
# Don't record error/access logs for robots.txt.
location = /robots.txt {
log_not_found off;
access_log off;
}
# Don't record error/access logs for static assets.
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|css|js)$ {
log_not_found off;
access_log off;
}

View File

@ -0,0 +1,32 @@
# Don't cache appcache, document html and data.
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
expires -1;
}
# Cache RSS and Atom feeds.
location ~* \.(?:rss|atom)$ {
expires 1h;
add_header Cache-Control "public";
}
# Caches images, icons, video, audio, HTC, etc.
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1y;
add_header Cache-Control "public";
# Comment out these lines if you wish to record access/error logs for static files.
log_not_found off;
access_log off;
}
# Cache CSS and JavaScript.
location ~* \.(?:css|js)$ {
expires 1y;
add_header Cache-Control "public";
}
# Don't record access/error logs for robots.txt.
location = /robots.txt {
log_not_found off;
access_log off;
}

View File

@ -23,8 +23,8 @@ server {
# Exclusions
include per-site/exclusions.conf;
# Cache static content
include per-site/cache.conf;
# Static content
include per-site/static-files.conf;
# Fastcgi cache rules
include per-site/fastcgi-cache.conf;

View File

@ -18,8 +18,8 @@ server {
# Exclusions
include per-site/exclusions.conf;
# Cache static content
include per-site/cache.conf;
# Static content
include per-site/static-files.conf;
location / {
try_files $uri $uri/ /index.php?$args;

View File

@ -18,8 +18,8 @@ server {
# Exclusions
include per-site/exclusions.conf;
# Cache static content
include per-site/cache.conf;
# Static content
include per-site/static-files.conf;
location / {
try_files $uri $uri/ /index.php?$args;

View File

@ -18,8 +18,8 @@ server {
# Exclusions
include per-site/exclusions.conf;
# Cache static content
include per-site/cache.conf;
# Static content
include per-site/static-files.conf;
location / {
try_files $uri $uri/ /index.php?$args;

View File

@ -23,8 +23,8 @@ server {
# Exclusions
include per-site/exclusions.conf;
# Cache static content
include per-site/cache.conf;
# Static content
include per-site/static-files.conf;
# SSL rules
include per-site/ssl.conf;