From 61a4f64bbb165b3585039d83fa6a0cce2d0f24eb Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Mon, 14 Jul 2025 16:11:35 -0500 Subject: [PATCH] r/nginx: Fix disabling access/error log files It turns out _nginx_ has a built-in default value for `access_log` and `error_log`, even if they are omitted from the configuration file. To actually disable writing logs to a file, we need to explicitly specify `off`. --- roles/nginx/templates/nginx.conf.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/nginx/templates/nginx.conf.j2 b/roles/nginx/templates/nginx.conf.j2 index 638934a..2932aa7 100644 --- a/roles/nginx/templates/nginx.conf.j2 +++ b/roles/nginx/templates/nginx.conf.j2 @@ -6,6 +6,8 @@ user {{ nginx_user }}; worker_processes auto; {% if nginx_error_log_file %} error_log {{ nginx_error_log_file }}; +{% elif not nginx_error_log_syslog|bool %} +error_log off; {% endif %} {% if nginx_error_log_syslog|bool %} error_log syslog:server=unix:/dev/log,facility=daemon,nohostname; @@ -26,6 +28,8 @@ http { {% if nginx_access_log_file %} access_log {{ nginx_access_log_file }} main; +{% elif not nginx_access_log_syslog|bool %} + access_log off; {% endif %} {% if nginx_access_log_syslog|bool %} access_log syslog:server=unix:/dev/log,facility=daemon,nohostname main;