Skip to content

Commit

Permalink
feat: now we can configure the listen address with `NGINX_LISTEN_ADDR…
Browse files Browse the repository at this point in the history
…ESS`
  • Loading branch information
Joxit committed Dec 10, 2021
1 parent 68f3ae4 commit 031df93
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nginx.conf → default.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ map $sent_http_content_type $expires {
}

server {
listen 80;
listen ${NGINX_LISTEN_ADDRESS};
root /usr/share/nginx/html;
expires $expires;

Expand Down
4 changes: 3 additions & 1 deletion mainline/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
FROM nginx:mainline-alpine

COPY nginx.conf /etc/nginx/conf.d/default.conf
ENV NGINX_LISTEN_ADDRESS 80

COPY default.conf.template /etc/nginx/templates/default.conf.template
4 changes: 3 additions & 1 deletion mainline/debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
FROM nginx:mainline

COPY nginx.conf /etc/nginx/conf.d/default.conf
ENV NGINX_LISTEN_ADDRESS 80

COPY default.conf.template /etc/nginx/templates/default.conf.template
4 changes: 3 additions & 1 deletion stable/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
FROM nginx:stable-alpine

COPY nginx.conf /etc/nginx/conf.d/default.conf
ENV NGINX_LISTEN_ADDRESS 80

COPY default.conf.template /etc/nginx/templates/default.conf.template
4 changes: 3 additions & 1 deletion stable/debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
FROM nginx:stable

COPY nginx.conf /etc/nginx/conf.d/default.conf
ENV NGINX_LISTEN_ADDRESS 80

COPY default.conf.template /etc/nginx/templates/default.conf.template

0 comments on commit 031df93

Please sign in to comment.