Skip to content

Commit

Permalink
Merge pull request #375 from netlogix/feature/nginx-1.27.3
Browse files Browse the repository at this point in the history
feat: update nginx to 1.27.3 and imgproxy config
  • Loading branch information
saschanowak authored Dec 18, 2024
2 parents 6180337 + 15086d4 commit e66ba13
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1
# Adding third-party modules to nginx official image
# SEE https://github.com/nginxinc/docker-nginx/tree/master/modules
FROM nginx:1.27.2 AS builder
FROM nginx:1.27.3 AS builder

ENV ENABLED_MODULES="headers-more subs-filter geoip2"
SHELL ["/bin/bash", "-exo", "pipefail", "-c"]
Expand Down Expand Up @@ -70,7 +70,7 @@ RUN apt-get update \
done \
&& echo "BUILT_MODULES=\"$BUILT_MODULES\"" > /tmp/packages/modules.env

FROM nginx:1.27.2 AS nginx
FROM nginx:1.27.3 AS nginx
ENV TZ="Europe/Berlin"
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

Expand All @@ -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 e66ba13

Please sign in to comment.