1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2024-11-22 11:56:31 +00:00

Set DISABLE_ACCESS_LOGS to disable access logs

This commit is contained in:
Mario Carbajal 2018-03-27 21:18:45 -03:00 committed by GitHub
parent 71225a28fa
commit f68383add9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,6 +88,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.
@ -95,7 +97,7 @@ server {
{{ if $enable_ipv6 }} {{ if $enable_ipv6 }}
listen [::]:80; listen [::]:80;
{{ end }} {{ end }}
access_log /var/log/nginx/access.log vhost; {{ $access_log }}
return 503; return 503;
} }
@ -106,7 +108,7 @@ server {
{{ if $enable_ipv6 }} {{ if $enable_ipv6 }}
listen [::]:443 ssl http2; listen [::]:443 ssl http2;
{{ end }} {{ end }}
access_log /var/log/nginx/access.log vhost; {{ $access_log }}
return 503; return 503;
ssl_session_tickets off; ssl_session_tickets off;
@ -197,7 +199,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 }}
return 301 https://$host$request_uri; return 301 https://$host$request_uri;
} }
{{ end }} {{ end }}
@ -208,7 +210,7 @@ server {
{{ if $enable_ipv6 }} {{ if $enable_ipv6 }}
listen [::]:443 ssl http2 {{ $default_server }}; listen [::]:443 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
@ -306,7 +308,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
@ -349,7 +351,7 @@ server {
{{ if $enable_ipv6 }} {{ if $enable_ipv6 }}
listen [::]:443 ssl http2 {{ $default_server }}; listen [::]:443 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;