From deca493912dfbea07e6e2e584c64ebb16e68ec34 Mon Sep 17 00:00:00 2001 From: chaptergy Date: Sun, 30 May 2021 20:14:35 +0200 Subject: [PATCH] Splits access and error logs for each host --- backend/templates/dead_host.conf | 3 ++- backend/templates/default.conf | 3 ++- backend/templates/letsencrypt-request.conf | 3 ++- backend/templates/proxy_host.conf | 4 ++-- backend/templates/redirection_host.conf | 3 ++- docker/rootfs/etc/nginx/conf.d/default.conf | 4 ++-- docker/rootfs/etc/nginx/nginx.conf | 5 ++--- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/backend/templates/dead_host.conf b/backend/templates/dead_host.conf index be53f6df..d94dff57 100644 --- a/backend/templates/dead_host.conf +++ b/backend/templates/dead_host.conf @@ -7,7 +7,8 @@ server { {% include "_hsts.conf" %} {% include "_forced_ssl.conf" %} - access_log /data/logs/dead_host-{{ id }}.log standard; + access_log /data/logs/dead-host-{{ id }}_access.log standard; + error_log /data/logs/dead-host-{{ id }}_error.log warn; {{ advanced_config }} diff --git a/backend/templates/default.conf b/backend/templates/default.conf index 56b67090..7eef11f6 100644 --- a/backend/templates/default.conf +++ b/backend/templates/default.conf @@ -12,7 +12,8 @@ server { #listen [::]:80; {% endif %} server_name default-host.localhost; - access_log /data/logs/default_host.log combined; + access_log /data/logs/default-host_access.log combined; + error_log /data/logs/default-host_error.log warn; {% include "_exploits.conf" %} {%- if value == "404" %} diff --git a/backend/templates/letsencrypt-request.conf b/backend/templates/letsencrypt-request.conf index cda2f892..676c8a60 100644 --- a/backend/templates/letsencrypt-request.conf +++ b/backend/templates/letsencrypt-request.conf @@ -8,7 +8,8 @@ server { server_name {{ domain_names | join: " " }}; - access_log /data/logs/letsencrypt-requests.log standard; + access_log /data/logs/letsencrypt-requests_access.log standard; + error_log /data/logs/letsencrypt-requests_error.log warn; include conf.d/include/letsencrypt-acme-challenge.conf; diff --git a/backend/templates/proxy_host.conf b/backend/templates/proxy_host.conf index 538b85e5..ec30cca0 100644 --- a/backend/templates/proxy_host.conf +++ b/backend/templates/proxy_host.conf @@ -19,8 +19,8 @@ proxy_set_header Connection $http_connection; proxy_http_version 1.1; {% endif %} - - access_log /data/logs/proxy_host-{{ id }}.log proxy; + access_log /data/logs/proxy-host-{{ id }}_access.log proxy; + error_log /data/logs/proxy-host-{{ id }}_error.log warn; {{ advanced_config }} diff --git a/backend/templates/redirection_host.conf b/backend/templates/redirection_host.conf index f42e146b..339fe72e 100644 --- a/backend/templates/redirection_host.conf +++ b/backend/templates/redirection_host.conf @@ -9,7 +9,8 @@ server { {% include "_hsts.conf" %} {% include "_forced_ssl.conf" %} - access_log /data/logs/redirection_host-{{ id }}.log standard; + access_log /data/logs/redirection-host-{{ id }}_access.log standard; + error_log /data/logs/redirection-host-{{ id }}_error.log warn; {{ advanced_config }} diff --git a/docker/rootfs/etc/nginx/conf.d/default.conf b/docker/rootfs/etc/nginx/conf.d/default.conf index d1684ea7..230b43e3 100644 --- a/docker/rootfs/etc/nginx/conf.d/default.conf +++ b/docker/rootfs/etc/nginx/conf.d/default.conf @@ -8,7 +8,7 @@ server { set $port "80"; server_name localhost-nginx-proxy-manager; - access_log /data/logs/default.log standard; + access_log /data/logs/fallback-access.log standard; error_log /dev/null crit; include conf.d/include/assets.conf; include conf.d/include/block-exploits.conf; @@ -29,7 +29,7 @@ server { set $port "443"; server_name localhost; - access_log /data/logs/default.log standard; + access_log /data/logs/fallback-access.log standard; error_log /dev/null crit; ssl_certificate /data/nginx/dummycert.pem; ssl_certificate_key /data/nginx/dummykey.pem; diff --git a/docker/rootfs/etc/nginx/nginx.conf b/docker/rootfs/etc/nginx/nginx.conf index 40432968..ae25253f 100644 --- a/docker/rootfs/etc/nginx/nginx.conf +++ b/docker/rootfs/etc/nginx/nginx.conf @@ -9,7 +9,7 @@ worker_processes auto; # Enables the use of JIT for regular expressions to speed-up their processing. pcre_jit on; -error_log /data/logs/error.log warn; +error_log /data/logs/fallback-error.log warn; # Includes files with directives to load dynamic modules. include /etc/nginx/modules/*.conf; @@ -46,8 +46,7 @@ http { log_format proxy '[$time_local] $upstream_cache_status $upstream_status $status - $request_method $scheme $host "$request_uri" [Client $remote_addr] [Length $body_bytes_sent] [Gzip $gzip_ratio] [Sent-to $server] "$http_user_agent" "$http_referer"'; log_format standard '[$time_local] $status - $request_method $scheme $host "$request_uri" [Client $remote_addr] [Length $body_bytes_sent] [Gzip $gzip_ratio] "$http_user_agent" "$http_referer"'; - - access_log /data/logs/default.log proxy; + access_log /data/logs/fallback-access.log proxy; # Dynamically generated resolvers file include /etc/nginx/conf.d/include/resolvers.conf;