diff --git a/src/nginxconfig/generators/conf/nginx.conf.js b/src/nginxconfig/generators/conf/nginx.conf.js index e2feb5f..d99586c 100644 --- a/src/nginxconfig/generators/conf/nginx.conf.js +++ b/src/nginxconfig/generators/conf/nginx.conf.js @@ -107,8 +107,19 @@ export default (domains, global) => { } config.http.push(['# Logging', '']); - config.http.push(['access_log', (global.logging.accessLog.computed.trim() + (global.logging.cloudflare.computed ? ' cloudflare' : '')) || 'off']); - config.http.push(['error_log', global.logging.errorLog.computed.trim() || '/dev/null']); + if (global.logging.accessLog.computed) { + config.http.push(['access_log', global.logging.accessLogPath.computed.trim() + + (global.logging.cloudflare.computed ? ' cloudflare' : '') + + (global.logging.accessLogArguments.computed ? ` ${global.logging.accessLogArguments.computed.trim()}` : '') + ]); + } else { + config.http.push(['access_log', 'off']); + } + if (global.logging.errorLog.computed) { + config.http.push(['error_log', global.logging.errorLogPath.computed.trim()]); + } else { + config.http.push(['error_log', '/dev/null']); + } if (global.security.limitReq.computed) { config.http.push(['# Limits', '']); diff --git a/src/nginxconfig/generators/conf/website.conf.js b/src/nginxconfig/generators/conf/website.conf.js index 0363f5d..63e432b 100644 --- a/src/nginxconfig/generators/conf/website.conf.js +++ b/src/nginxconfig/generators/conf/website.conf.js @@ -226,7 +226,10 @@ export default (domain, domains, global, ipPortPairs) => { if (domain.logging.accessLog.computed) serverConfig.push(['access_log', - getAccessLogDomainPath(domain, global) + (global.logging.cloudflare.computed ? ' cloudflare' : '')]); + getAccessLogDomainPath(domain, global) + + (global.logging.cloudflare.computed ? ' cloudflare' : '') + + (global.logging.accessLogArguments.computed ? ` ${global.logging.accessLogArguments.computed.trim()}`: '') + ]); if (domain.logging.errorLog.computed) serverConfig.push(['error_log', getErrorLogDomainPath(domain, global)]); @@ -369,9 +372,6 @@ export default (domain, domains, global, ipPortPairs) => { // HTTPS cdnConfig.push(...sslConfig(domain, global)); - cdnConfig.push(['# disable access_log', '']); - cdnConfig.push(['access_log', 'off']); - // Gzip if (global.performance.gzipCompression.computed) { cdnConfig.push(['# gzip', '']); diff --git a/src/nginxconfig/templates/domain_sections/logging.vue b/src/nginxconfig/templates/domain_sections/logging.vue index 3335a0e..39969ef 100644 --- a/src/nginxconfig/templates/domain_sections/logging.vue +++ b/src/nginxconfig/templates/domain_sections/logging.vue @@ -69,11 +69,11 @@ THE SOFTWARE. const defaults = { accessLog: { - default: false, + default: true, enabled: true, }, errorLog: { - default: false, + default: true, enabled: true, }, }; diff --git a/src/nginxconfig/templates/global_sections/logging.vue b/src/nginxconfig/templates/global_sections/logging.vue index c831a3b..9b36917 100644 --- a/src/nginxconfig/templates/global_sections/logging.vue +++ b/src/nginxconfig/templates/global_sections/logging.vue @@ -33,11 +33,36 @@ THE SOFTWARE.