From 25ad8126e6a94e852d83ce2ef1a682e6b42bb9a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ulbrich=20=28Zalari=20UG=20haftungsbeschra?= =?UTF-8?q?=CC=88nkt=29?= Date: Wed, 10 Feb 2016 12:36:05 +0100 Subject: [PATCH] add feature to enable additional nginx config --- Dockerfile | 3 +++ README.md | 16 ++++++++++++++++ nginx/extra/empty-for-build.conf | 2 ++ nginx/nginx.conf | 3 +++ 4 files changed, 24 insertions(+) create mode 100644 nginx/extra/empty-for-build.conf diff --git a/Dockerfile b/Dockerfile index b39e6b6..fef472c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,10 +21,13 @@ MAINTAINER Evan Brown RUN rm /etc/nginx/conf.d/*.conf +RUN mkdir -p /etc/nginx/extra-conf.d + WORKDIR /usr/src ADD start.sh /usr/src/ ADD nginx/nginx.conf /etc/nginx/ ADD nginx/proxy*.conf /usr/src/ +ADD nginx/extra/*.conf /etc/nginx/extra-conf.d/ ENTRYPOINT ./start.sh diff --git a/README.md b/README.md index ead96c2..4cc43e6 100644 --- a/README.md +++ b/README.md @@ -64,3 +64,19 @@ To run an SSL termination proxy you must have an existing SSL certificate and ke -v /path/to/secrets/htpasswd:/etc/secrets/htpasswd \ nginx-ssl-proxy ``` +4. **Add additional nginx config** + + All *.conf from [nginx/extra](nginx/extra) are added during *built* to **/etc/nginx/extra-conf.d** and get included on startup of the container. Using volumes you can overwrite them on *start* of the container: + + ```shell + docker run \ + -e ENABLE_SSL=true \ + -e TARGET_SERVICE=THE_ADDRESS_OR_HOST_YOU_ARE_PROXYING_TO \ + -v /path/to/secrets/cert.crt:/etc/secrets/proxycert \ + -v /path/to/secrets/key.pem:/etc/secrets/proxykey \ + -v /path/to/secrets/dhparam.pem:/etc/secrets/dhparam \ + -v /path/to/additional-nginx.conf:/etc/nginx/extra-conf.d/additional_proxy.conf \ + nginx-ssl-proxy + ``` + + That way it is possible to setup additional proxies or modifying the nginx configuration. \ No newline at end of file diff --git a/nginx/extra/empty-for-build.conf b/nginx/extra/empty-for-build.conf new file mode 100644 index 0000000..1792293 --- /dev/null +++ b/nginx/extra/empty-for-build.conf @@ -0,0 +1,2 @@ +#this file is intentionally left emtpy, because +#otherwise docker-compose or the hub fails the build... \ No newline at end of file diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 724bfb9..be887e7 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -28,4 +28,7 @@ http { #gzip on; client_max_body_size 20M; include /etc/nginx/conf.d/proxy.conf; + + #additional config + include /etc/nginx/extra-conf.d/*; }