diff --git a/system/options.nix b/system/options.nix index 4f6ead3d32b..4b8face4306 100644 --- a/system/options.nix +++ b/system/options.nix @@ -1194,6 +1194,16 @@ "; }; + logPerVirtualHost = mkOption { + default = false; + description = " + If enabled, each virtual host gets its own + access_log and + error_log, namely suffixed by the + of the virtual host. + "; + }; + user = mkOption { default = "wwwrun"; description = " diff --git a/upstart-jobs/apache-httpd/default.nix b/upstart-jobs/apache-httpd/default.nix index 3efa1fc1a0c..9d3a614c329 100644 --- a/upstart-jobs/apache-httpd/default.nix +++ b/upstart-jobs/apache-httpd/default.nix @@ -196,6 +196,11 @@ let ServerAdmin ${cfg.adminAddr} '' else ""} + ${if !isMainServer && mainCfg.logPerVirtualHost then '' + ErrorLog ${mainCfg.logDir}/error_log-${cfg.hostName} + CustomLog ${mainCfg.logDir}/access_log-${cfg.hostName} common + '' else ""} + ${robotsConf} ${if isMainServer || cfg.documentRoot != null then documentRootConf else ""}