From 886b9e27a6a34f714eca5f5e750884a1ac57e810 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 18 Nov 2013 17:00:24 +0100 Subject: httpd.nix: Support non-root operation --- nixos/modules/services/web-servers/apache-httpd/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'nixos/modules/services') diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index 900948893489..cdb42fa7308a 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -628,10 +628,10 @@ in preStart = '' mkdir -m 0750 -p ${mainCfg.stateDir} - chown root.${mainCfg.group} ${mainCfg.stateDir} + [ $(id -u) != 0 ] || chown root.${mainCfg.group} ${mainCfg.stateDir} ${optionalString version24 '' mkdir -m 0750 -p "${mainCfg.stateDir}/runtime" - chown root.${mainCfg.group} "${mainCfg.stateDir}/runtime" + [ $(id -u) != 0 ] || chown root.${mainCfg.group} "${mainCfg.stateDir}/runtime" ''} mkdir -m 0700 -p ${mainCfg.logDir} @@ -659,6 +659,7 @@ in serviceConfig.ExecStart = "@${httpd}/bin/httpd httpd -f ${httpdConf}"; serviceConfig.ExecStop = "${httpd}/bin/httpd -f ${httpdConf} -k graceful-stop"; serviceConfig.Type = "forking"; + serviceConfig.PIDFile = "${mainCfg.stateDir}/httpd.pid"; serviceConfig.Restart = "always"; }; -- cgit 1.4.1