nixos/httpd: drop stateDir option, hardcode to /run/httpd
This commit is contained in:
parent
86ccc63008
commit
9c28599bfe
@ -6,6 +6,8 @@ let
|
|||||||
|
|
||||||
mainCfg = config.services.httpd;
|
mainCfg = config.services.httpd;
|
||||||
|
|
||||||
|
runtimeDir = "/run/httpd";
|
||||||
|
|
||||||
httpd = mainCfg.package.out;
|
httpd = mainCfg.package.out;
|
||||||
|
|
||||||
httpdConf = mainCfg.configFile;
|
httpdConf = mainCfg.configFile;
|
||||||
@ -98,7 +100,7 @@ let
|
|||||||
|
|
||||||
|
|
||||||
sslConf = ''
|
sslConf = ''
|
||||||
SSLSessionCache shmcb:${mainCfg.stateDir}/ssl_scache(512000)
|
SSLSessionCache shmcb:${runtimeDir}/ssl_scache(512000)
|
||||||
|
|
||||||
Mutex posixsem
|
Mutex posixsem
|
||||||
|
|
||||||
@ -239,13 +241,13 @@ let
|
|||||||
|
|
||||||
ServerRoot ${httpd}
|
ServerRoot ${httpd}
|
||||||
|
|
||||||
DefaultRuntimeDir ${mainCfg.stateDir}/runtime
|
DefaultRuntimeDir ${runtimeDir}/runtime
|
||||||
|
|
||||||
PidFile ${mainCfg.stateDir}/httpd.pid
|
PidFile ${runtimeDir}/httpd.pid
|
||||||
|
|
||||||
${optionalString (mainCfg.multiProcessingModule != "prefork") ''
|
${optionalString (mainCfg.multiProcessingModule != "prefork") ''
|
||||||
# mod_cgid requires this.
|
# mod_cgid requires this.
|
||||||
ScriptSock ${mainCfg.stateDir}/cgisock
|
ScriptSock ${runtimeDir}/cgisock
|
||||||
''}
|
''}
|
||||||
|
|
||||||
<IfModule prefork.c>
|
<IfModule prefork.c>
|
||||||
@ -337,6 +339,7 @@ in
|
|||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
(mkRemovedOptionModule [ "services" "httpd" "extraSubservices" ] "Most existing subservices have been ported to the NixOS module system. Please update your configuration accordingly.")
|
(mkRemovedOptionModule [ "services" "httpd" "extraSubservices" ] "Most existing subservices have been ported to the NixOS module system. Please update your configuration accordingly.")
|
||||||
|
(mkRemovedOptionModule [ "services" "httpd" "stateDir" ] "The httpd module now uses /run/httpd as a runtime directory.")
|
||||||
];
|
];
|
||||||
|
|
||||||
###### interface
|
###### interface
|
||||||
@ -431,16 +434,6 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
stateDir = mkOption {
|
|
||||||
type = types.path;
|
|
||||||
default = "/run/httpd";
|
|
||||||
description = ''
|
|
||||||
Directory for Apache's transient runtime state (such as PID
|
|
||||||
files). It is created automatically. Note that the default,
|
|
||||||
<filename>/run/httpd</filename>, is deleted at boot time.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
virtualHosts = mkOption {
|
virtualHosts = mkOption {
|
||||||
type = types.listOf (types.submodule (
|
type = types.listOf (types.submodule (
|
||||||
{ options = import ./per-server-options.nix {
|
{ options = import ./per-server-options.nix {
|
||||||
@ -611,12 +604,6 @@ in
|
|||||||
|
|
||||||
preStart =
|
preStart =
|
||||||
''
|
''
|
||||||
mkdir -m 0750 -p ${mainCfg.stateDir}
|
|
||||||
[ $(id -u) != 0 ] || chown root.${mainCfg.group} ${mainCfg.stateDir}
|
|
||||||
|
|
||||||
mkdir -m 0750 -p "${mainCfg.stateDir}/runtime"
|
|
||||||
[ $(id -u) != 0 ] || chown root.${mainCfg.group} "${mainCfg.stateDir}/runtime"
|
|
||||||
|
|
||||||
mkdir -m 0700 -p ${mainCfg.logDir}
|
mkdir -m 0700 -p ${mainCfg.logDir}
|
||||||
|
|
||||||
# Get rid of old semaphores. These tend to accumulate across
|
# Get rid of old semaphores. These tend to accumulate across
|
||||||
@ -630,10 +617,13 @@ in
|
|||||||
serviceConfig.ExecStart = "@${httpd}/bin/httpd httpd -f ${httpdConf}";
|
serviceConfig.ExecStart = "@${httpd}/bin/httpd httpd -f ${httpdConf}";
|
||||||
serviceConfig.ExecStop = "${httpd}/bin/httpd -f ${httpdConf} -k graceful-stop";
|
serviceConfig.ExecStop = "${httpd}/bin/httpd -f ${httpdConf} -k graceful-stop";
|
||||||
serviceConfig.ExecReload = "${httpd}/bin/httpd -f ${httpdConf} -k graceful";
|
serviceConfig.ExecReload = "${httpd}/bin/httpd -f ${httpdConf} -k graceful";
|
||||||
|
serviceConfig.Group = mainCfg.group;
|
||||||
serviceConfig.Type = "forking";
|
serviceConfig.Type = "forking";
|
||||||
serviceConfig.PIDFile = "${mainCfg.stateDir}/httpd.pid";
|
serviceConfig.PIDFile = "${runtimeDir}/httpd.pid";
|
||||||
serviceConfig.Restart = "always";
|
serviceConfig.Restart = "always";
|
||||||
serviceConfig.RestartSec = "5s";
|
serviceConfig.RestartSec = "5s";
|
||||||
|
serviceConfig.RuntimeDirectory = "httpd httpd/runtime";
|
||||||
|
serviceConfig.RuntimeDirectoryMode = "0750";
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user