diff --git a/Dockerfile b/Dockerfile index 5d5fe73..56e5d20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -65,11 +65,39 @@ CMD ["php-fpm"] # ================================================================================ -FROM fholzer/nginx-brotli:v1.16.0 AS web +FROM fholzer/nginx-brotli:v1.19.1 AS web ENV PHP_SERVERS php:9000 -RUN rm /etc/nginx/conf.d/default.conf \ +# Add headers-more-nginx-module +RUN apk add --update --no-cache --virtual ".nginx-module-build-deps" \ + gcc \ + make \ + libc-dev \ + g++ \ + openssl-dev \ + linux-headers \ + pcre-dev \ + zlib-dev \ + libtool \ + automake \ + autoconf \ + git \ + && cd /opt \ + && git clone --depth 1 -b v0.33 --single-branch https://github.com/openresty/headers-more-nginx-module.git \ + && cd /opt/headers-more-nginx-module \ + && git submodule update --init \ + && cd /opt \ + && wget -O - http://nginx.org/download/nginx-$(nginx -v 2>&1 | sed 's@.*/@@').tar.gz | tar zxfv - \ + && cd /opt/nginx* \ + && ./configure --with-compat --add-dynamic-module=/opt/headers-more-nginx-module \ + && make modules \ + && cp /opt/nginx*/objs/ngx_http_headers_more_filter_module.so /usr/lib/nginx/modules/ \ + && sed -i '1iload_module \/usr\/lib\/nginx\/modules\/ngx_http_headers_more_filter_module.so;' /etc/nginx/nginx.conf \ + && rm -rf /opt/* \ + && apk del ".nginx-module-build-deps" \ + # Prepare image for the application + && rm /etc/nginx/conf.d/default.conf \ && mkdir -p /data/nginx/cache \ && mkdir -p /var/www/html diff --git a/docker/nginx/account.ely.by.conf.template b/docker/nginx/account.ely.by.conf.template index 24dd49c..6b5e841 100644 --- a/docker/nginx/account.ely.by.conf.template +++ b/docker/nginx/account.ely.by.conf.template @@ -35,6 +35,10 @@ server { } location / { + if ($request_uri = '/') { + more_set_headers "X-Authlib-Injector-API-Location: /api/authlib-injector"; + } + root $frontend_path; access_log off; etag on; diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf index 811236a..c14d494 100644 --- a/docker/nginx/nginx.conf +++ b/docker/nginx/nginx.conf @@ -1,3 +1,5 @@ +load_module /usr/lib/nginx/modules/ngx_http_headers_more_filter_module.so; + user nginx; worker_processes auto;