Skip to content

Commit

Permalink
feat: add imgproxy config
Browse files Browse the repository at this point in the history
  • Loading branch information
saschanowak committed Dec 18, 2024
1 parent 1914fa7 commit 15086d4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ COPY docker-entrypoint.d /docker-entrypoint.d

# Test nginx config
RUN nginx -t
VOLUME /var/cache/nginx

HEALTHCHECK --interval=2s --timeout=20s --retries=10 CMD curl --silent --fail http://127.0.0.1:90/health || exit 1

Expand Down
7 changes: 7 additions & 0 deletions nginx/etc/nginx/conf.d/imgproxy.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
proxy_cache_path /var/cache/nginx/imgproxy levels=1:2 use_temp_path=off keys_zone=IMAGE_CACHE:32m max_size=10G min_free=32m inactive=7d;

map $http_accept $imgproxy_extension {
default '';
~*webp '@webp';
~*avif '@avif';
}
7 changes: 7 additions & 0 deletions nginx/etc/nginx/includes/imgproxy
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
location /images/ {
add_header X-Proxy-Cache $upstream_cache_status;
proxy_cache IMAGE_CACHE;
proxy_cache_lock on;
proxy_cache_key "$host$request_uri $imgproxy_extension";
proxy_pass http://imgproxy:8080/;
}
8 changes: 8 additions & 0 deletions nginx/examples/imgproxy.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
server {
listen 80;

server_name ${DOMAIN_ENV};

include includes/php;
include includes/imgproxy;
}

0 comments on commit 15086d4

Please sign in to comment.