From e23ba2a1b0ec3d06c347c241042bd1e9f1fee074 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Sun, 2 Feb 2020 08:08:02 -0500 Subject: Revert "nixos/httpd: symlink apache configuration to /etc/httpd/httpd.conf for use in the apachectl command" This reverts commit 336a6f471f1e40d4a440b4176c2a1b8db65fe007. --- nixos/modules/services/web-servers/apache-httpd/default.nix | 3 --- 1 file changed, 3 deletions(-) (limited to 'nixos/modules/services/web-servers/apache-httpd/default.nix') diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index 3200a26364f..6a497c40def 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -643,9 +643,6 @@ in environment.systemPackages = [ pkg ]; - # required for "apachectl configtest" - environment.etc."httpd/httpd.conf".source = httpdConf; - services.httpd.phpOptions = '' ; Needed for PHP's mail() function. -- cgit 1.4.1 From 0b91dfedbc4fda3068b58e8514b58f94c7fa972b Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Sun, 2 Feb 2020 08:38:57 -0500 Subject: nixos/httpd: override apachectl command to use generated httpd configuration --- nixos/modules/services/web-servers/apache-httpd/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'nixos/modules/services/web-servers/apache-httpd/default.nix') diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index 6a497c40def..5ff3c5d313b 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -10,6 +10,12 @@ let pkg = cfg.package.out; + apachectl = pkgs.runCommand "apachectl" { meta.priority = -1; } '' + mkdir -p $out/bin + cp ${pkg}/bin/apachectl $out/bin/apachectl + sed -i $out/bin/apachectl -e 's|$HTTPD -t|$HTTPD -t -f ${httpdConf}|' + ''; + httpdConf = cfg.configFile; php = cfg.phpPackage.override { apacheHttpd = pkg.dev; /* otherwise it only gets .out */ }; @@ -641,7 +647,10 @@ in postRun = "systemctl reload httpd.service"; }) (filterAttrs (name: hostOpts: hostOpts.enableACME) cfg.virtualHosts); - environment.systemPackages = [ pkg ]; + environment.systemPackages = [ + apachectl + pkg + ]; services.httpd.phpOptions = '' -- cgit 1.4.1 From 06d17caf9251136b6e795c8729e70286efe1cd70 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Wed, 19 Aug 2020 12:38:20 -0400 Subject: nixos/httpd: configure log rotation --- .../services/web-servers/apache-httpd/default.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'nixos/modules/services/web-servers/apache-httpd/default.nix') diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index e1d1217943b..0b5d57055ed 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -655,6 +655,25 @@ in # required for "apachectl configtest" environment.etc."httpd/httpd.conf".source = httpdConf; + services.logrotate = optionalAttrs (cfg.logFormat != "none") { + enable = mkDefault true; + paths.httpd = { + path = "${cfg.logDir}/*.log"; + user = cfg.user; + group = cfg.group; + frequency = "daily"; + keep = 28; + extraConfig = '' + sharedscripts + compress + delaycompress + postrotate + systemctl reload httpd.service > /dev/null 2>/dev/null || true + endscript + ''; + }; + }; + services.httpd.phpOptions = '' ; Needed for PHP's mail() function. -- cgit 1.4.1