Skip to content

Commit

Permalink
add proxy cache setup for thumbnail images (#24)
Browse files Browse the repository at this point in the history
attempt to do less upstream proxying, instead add a response caching system and serve from here for actively requested files
  • Loading branch information
camallen authored Jul 22, 2022
1 parent 8bacebe commit 39c3f2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
FROM nginx:alpine

RUN mkdir -p /nginx-cache/

COPY nginx.conf /etc/nginx/nginx.conf
9 changes: 8 additions & 1 deletion nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,18 @@ http {
# error_log /dev/stderr debug;

sendfile on;
#tcp_nopush on;
tcp_nopush on;

keepalive_timeout 65;

proxy_cache_path /nginx-cache/ levels=1:2 keys_zone=STATIC:10m max_size=500m;

server {
# use the nginx proxy cache defined above in HTTP block
proxy_cache STATIC;
proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;

if ($uri ~ "^/([1-9][0-9]{0,2})x([1-9][0-9]{0,2})/") {
set $width $1;
set $height $2;
Expand Down

0 comments on commit 39c3f2d

Please sign in to comment.