diff --git a/Dockerfile b/Dockerfile index c2b757e..8388d8c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,7 @@ ENV PROXY_UWSGI=0 ENV LISTEN_PORT=80 ENV HEALTHCHECK_PATH="/lb-status/" ENV STATIC_LOCATIONS= +ENV NO_ACCESS_LOGS=0 EXPOSE 80 STOPSIGNAL SIGQUIT ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/README.md b/README.md index b095a3b..886c76e 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Pair nginx-proxy with your favorite upstream server (wsgi, uwsgi, asgi, et al.) | `PROXY_UWSGI` | Whether to use native uwsgi support | No | 0 | 1 | | `KEEPALIVE_TIMEOUT` | What value to set HTTP keepalive (This should be higher than your ELB's timeout) | Yes | 65 | | | `HEALTHCHECK_PATH` | nginx-proxy disables healthcheck path access logs, you can configure the path here | Yes | /lb-status/ | | +| `NO_ACCESS_LOGS` | disable access logs completely | No | 0 | 1 | ### Hosting Static Assets diff --git a/src/etc/nginx/conf.d/default.conf.template b/src/etc/nginx/conf.d/default.conf.template index d298757..1bc6888 100644 --- a/src/etc/nginx/conf.d/default.conf.template +++ b/src/etc/nginx/conf.d/default.conf.template @@ -30,6 +30,9 @@ server { {{ end }} } + {{ if (eq .Env.NO_ACCESS_LOGS "1" ) }} + access_log off; + {{ else }} location {{ .Env.HEALTHCHECK_PATH }} { access_log off; {{ if (eq .Env.PROXY_UWSGI "1") }} @@ -38,6 +41,7 @@ server { include /etc/nginx/includes/proxy.conf; {{ end }} } + {{ end }} {{ if .Env.STATIC_LOCATIONS }} {{ range (.Env.STATIC_LOCATIONS | strings.Split "," )}}