From 031df93ae479fc88487b90bb142176d51a33b94d Mon Sep 17 00:00:00 2001 From: Joxit Date: Fri, 10 Dec 2021 18:09:29 +0100 Subject: [PATCH] feat: now we can configure the listen address with `NGINX_LISTEN_ADDRESS` --- README.md | 1 + nginx.conf => default.conf.template | 2 +- mainline/alpine/Dockerfile | 4 +++- mainline/debian/Dockerfile | 4 +++- stable/alpine/Dockerfile | 4 +++- stable/debian/Dockerfile | 4 +++- 6 files changed, 14 insertions(+), 5 deletions(-) rename nginx.conf => default.conf.template (98%) diff --git a/README.md b/README.md index da7be8a..25d4757 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ $ docker run --name some-nginx -p 8080:80 -v /some/content:/usr/share/nginx/html ## Additional features +- Run your server on a differrent port with the environment `NGINX_LISTEN_ADDRESS` - gzip on selected mime types - no-cache on html files - 24h of expiry for images diff --git a/nginx.conf b/default.conf.template similarity index 98% rename from nginx.conf rename to default.conf.template index 17897b7..9986844 100644 --- a/nginx.conf +++ b/default.conf.template @@ -56,7 +56,7 @@ map $sent_http_content_type $expires { } server { - listen 80; + listen ${NGINX_LISTEN_ADDRESS}; root /usr/share/nginx/html; expires $expires; diff --git a/mainline/alpine/Dockerfile b/mainline/alpine/Dockerfile index 3c1e4a9..71677d5 100644 --- a/mainline/alpine/Dockerfile +++ b/mainline/alpine/Dockerfile @@ -1,3 +1,5 @@ FROM nginx:mainline-alpine -COPY nginx.conf /etc/nginx/conf.d/default.conf \ No newline at end of file +ENV NGINX_LISTEN_ADDRESS 80 + +COPY default.conf.template /etc/nginx/templates/default.conf.template \ No newline at end of file diff --git a/mainline/debian/Dockerfile b/mainline/debian/Dockerfile index 1b826ae..df53698 100644 --- a/mainline/debian/Dockerfile +++ b/mainline/debian/Dockerfile @@ -1,3 +1,5 @@ FROM nginx:mainline -COPY nginx.conf /etc/nginx/conf.d/default.conf \ No newline at end of file +ENV NGINX_LISTEN_ADDRESS 80 + +COPY default.conf.template /etc/nginx/templates/default.conf.template \ No newline at end of file diff --git a/stable/alpine/Dockerfile b/stable/alpine/Dockerfile index 793f9c4..7d400c3 100644 --- a/stable/alpine/Dockerfile +++ b/stable/alpine/Dockerfile @@ -1,3 +1,5 @@ FROM nginx:stable-alpine -COPY nginx.conf /etc/nginx/conf.d/default.conf \ No newline at end of file +ENV NGINX_LISTEN_ADDRESS 80 + +COPY default.conf.template /etc/nginx/templates/default.conf.template \ No newline at end of file diff --git a/stable/debian/Dockerfile b/stable/debian/Dockerfile index 0f02de5..ad8cc64 100644 --- a/stable/debian/Dockerfile +++ b/stable/debian/Dockerfile @@ -1,3 +1,5 @@ FROM nginx:stable -COPY nginx.conf /etc/nginx/conf.d/default.conf \ No newline at end of file +ENV NGINX_LISTEN_ADDRESS 80 + +COPY default.conf.template /etc/nginx/templates/default.conf.template \ No newline at end of file