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`.
unifi-restore
Dustin 2025-07-14 16:11:35 -05:00
parent b4f5b419e1
commit 61a4f64bbb
1 changed files with 4 additions and 0 deletions

View File

@ -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;