Skip to content

Commit

Permalink
Updated nginx static file directives to new disk caching structure
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmerfield committed Mar 12, 2018
1 parent 78778d4 commit d03b049
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
14 changes: 11 additions & 3 deletions config/nginx/blot-blogs.conf
Expand Up @@ -4,8 +4,9 @@ root /cache;

# use $request_uri if you want the query string also
# use $uri if you don't
set $cache /$host$uri;
set $cache_index /$host$uri/index.html;
set $cache_permanent_folder /$host/$scheme/permanent$request_uri;
set $cache_blot_folder /$host/$scheme/temporary$request_uri;
set $cache_blot_folder_index /$host/$scheme/temporary$request_uri/index.html;

# This is used to determine whether the server is handling
# requests, don't remove it unless you change monit.rc too!
Expand All @@ -14,8 +15,15 @@ location = /health {
}

location / {
add_header 'Cache-Hit' 'true-permanent' always;
add_header 'Cache-Control' 'max-age=31536000' always;
try_files $cache_permanent_folder @temporary;
}

location @temporary {
add_header 'Cache-Control' '' always;
add_header 'Cache-Hit' 'true' always;
try_files $cache $cache_index @blot;
try_files $cache_blot_folder $cache_blot_folder_index @blot;
}

location @blot {
Expand Down
12 changes: 10 additions & 2 deletions config/nginx/blot-site.conf
Expand Up @@ -4,8 +4,9 @@ root /cache;

# use $request_uri if you want the query string also
# use $uri if you don't
set $cache_blot_folder /$host$uri;
set $cache_blot_folder_index /$host$uri/index.html;
set $cache_permanent_folder /$host/$scheme/permanent$request_uri;
set $cache_blot_folder /$host/$scheme/temporary$request_uri;
set $cache_blot_folder_index /$host/$scheme/temporary$request_uri/index.html;

# This is used to determine whether the server is handling
# requests, don't remove it unless you change monit.rc too!
Expand All @@ -24,6 +25,13 @@ if ($cookie_connect.sid) {
}

location / {
add_header 'Cache-Hit' 'true-permanent' always;
add_header 'Cache-Control' 'max-age=31536000' always;
try_files $cache_permanent_folder @temporary;
}

location @temporary {
add_header 'Cache-Control' '' always;
add_header 'Cache-Hit' 'true' always;
try_files $cache_blot_folder $cache_blot_folder_index @blot;
}
Expand Down

0 comments on commit d03b049

Please sign in to comment.