1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2024-11-21 19:36:30 +00:00

Merge pull request #1113 from basro/master

Set DISABLE_ACCESS_LOGS env var to disable access logs
This commit is contained in:
Jason Wilder 2020-03-25 14:27:02 -06:00 committed by GitHub
commit 3cbc5417b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -138,6 +138,8 @@ proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port;
proxy_set_header Proxy ""; proxy_set_header Proxy "";
{{ end }} {{ end }}
{{ $access_log := (or (and (not $.Env.DISABLE_ACCESS_LOGS) "access_log /var/log/nginx/access.log vhost;") "") }}
{{ $enable_ipv6 := eq (or ($.Env.ENABLE_IPV6) "") "true" }} {{ $enable_ipv6 := eq (or ($.Env.ENABLE_IPV6) "") "true" }}
server { server {
server_name _; # This is just an invalid value which will never trigger on a real hostname. server_name _; # This is just an invalid value which will never trigger on a real hostname.
@ -145,7 +147,7 @@ server {
{{ if $enable_ipv6 }} {{ if $enable_ipv6 }}
listen [::]:{{ $external_http_port }}; listen [::]:{{ $external_http_port }};
{{ end }} {{ end }}
access_log /var/log/nginx/access.log vhost; {{ $access_log }}
return 503; return 503;
} }
@ -156,7 +158,7 @@ server {
{{ if $enable_ipv6 }} {{ if $enable_ipv6 }}
listen [::]:{{ $external_https_port }} ssl http2; listen [::]:{{ $external_https_port }} ssl http2;
{{ end }} {{ end }}
access_log /var/log/nginx/access.log vhost; {{ $access_log }}
return 503; return 503;
ssl_session_cache shared:SSL:50m; ssl_session_cache shared:SSL:50m;
@ -248,7 +250,7 @@ server {
{{ if $enable_ipv6 }} {{ if $enable_ipv6 }}
listen [::]:{{ $external_http_port }} {{ $default_server }}; listen [::]:{{ $external_http_port }} {{ $default_server }};
{{ end }} {{ end }}
access_log /var/log/nginx/access.log vhost; {{ $access_log }}
# Do not HTTPS redirect Let'sEncrypt ACME challenge # Do not HTTPS redirect Let'sEncrypt ACME challenge
location /.well-known/acme-challenge/ { location /.well-known/acme-challenge/ {
@ -271,7 +273,7 @@ server {
{{ if $enable_ipv6 }} {{ if $enable_ipv6 }}
listen [::]:{{ $external_https_port }} ssl http2 {{ $default_server }}; listen [::]:{{ $external_https_port }} ssl http2 {{ $default_server }};
{{ end }} {{ end }}
access_log /var/log/nginx/access.log vhost; {{ $access_log }}
{{ if eq $network_tag "internal" }} {{ if eq $network_tag "internal" }}
# Only allow traffic from internal clients # Only allow traffic from internal clients
@ -343,7 +345,7 @@ server {
{{ if $enable_ipv6 }} {{ if $enable_ipv6 }}
listen [::]:80 {{ $default_server }}; listen [::]:80 {{ $default_server }};
{{ end }} {{ end }}
access_log /var/log/nginx/access.log vhost; {{ $access_log }}
{{ if eq $network_tag "internal" }} {{ if eq $network_tag "internal" }}
# Only allow traffic from internal clients # Only allow traffic from internal clients
@ -388,7 +390,7 @@ server {
{{ if $enable_ipv6 }} {{ if $enable_ipv6 }}
listen [::]:{{ $external_https_port }} ssl http2 {{ $default_server }}; listen [::]:{{ $external_https_port }} ssl http2 {{ $default_server }};
{{ end }} {{ end }}
access_log /var/log/nginx/access.log vhost; {{ $access_log }}
return 500; return 500;
ssl_certificate /etc/nginx/certs/default.crt; ssl_certificate /etc/nginx/certs/default.crt;