From 54b9043323ad23950c5e1ebe132f7e1fb45a4dc8 Mon Sep 17 00:00:00 2001 From: Mike Dillon Date: Sat, 6 Dec 2014 17:45:59 -0800 Subject: [PATCH 1/2] Remove redundant access_log and error_log --- nginx.tmpl | 2 -- 1 file changed, 2 deletions(-) diff --git a/nginx.tmpl b/nginx.tmpl index 3aa28f4..ca372c9 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -30,8 +30,6 @@ proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto; server { listen 80 default_server; server_name _; # This is just an invalid value which will never trigger on a real hostname. - error_log /proc/self/fd/2; - access_log /proc/self/fd/1; return 503; } From ac1f2d88752a785db45ae66862dd19b2204f3899 Mon Sep 17 00:00:00 2001 From: Mike Dillon Date: Sat, 6 Dec 2014 17:46:25 -0800 Subject: [PATCH 2/2] Include Host or SERVER_NAME in logs --- nginx.tmpl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nginx.tmpl b/nginx.tmpl index ca372c9..3747678 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -14,7 +14,11 @@ map $http_upgrade $proxy_connection { gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; -access_log /proc/self/fd/1; +log_format vhost '$host $remote_addr - $remote_user [$time_local] ' + '"$request" $status $body_bytes_sent ' + '"$http_referer" "$http_user_agent"'; + +access_log /proc/self/fd/1 vhost; error_log /proc/self/fd/2; # HTTP 1.1 support