* Upstart job for Apache.
svn path=/nixos/trunk/; revision=7391
This commit is contained in:
parent
8293f1eb61
commit
70f929a0a5
@ -207,4 +207,13 @@
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
name = ["services" "httpd" "enable"];
|
||||
default = false;
|
||||
description = "
|
||||
Whether to enable the Apache httpd server.
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
|
@ -76,6 +76,13 @@ import ../upstart-jobs/gather.nix {
|
||||
inherit (pkgs.xorg) xorgserver xf86inputkeyboard xf86inputmouse xf86videovesa;
|
||||
})
|
||||
|
||||
# Apache httpd.
|
||||
++ optional ["services" "httpd" "enable"]
|
||||
(import ../upstart-jobs/httpd.nix {
|
||||
inherit pkgs;
|
||||
inherit (pkgs) glibc pwdutils;
|
||||
})
|
||||
|
||||
# Handles the reboot/halt events.
|
||||
++ (map
|
||||
(event: makeJob (import ../upstart-jobs/halt.nix {
|
||||
|
50
upstart-jobs/httpd.nix
Normal file
50
upstart-jobs/httpd.nix
Normal file
@ -0,0 +1,50 @@
|
||||
{pkgs, glibc, pwdutils}:
|
||||
|
||||
let
|
||||
|
||||
user = "wwwrun";
|
||||
group = "wwwrun";
|
||||
|
||||
webServer = import ../services/apache-httpd {
|
||||
inherit (pkgs) apacheHttpd coreutils;
|
||||
stdenv = pkgs.stdenvNew;
|
||||
|
||||
hostName = "localhost";
|
||||
httpPort = 80;
|
||||
|
||||
inherit user group;
|
||||
|
||||
adminAddr = "eelco@cs.uu.nl";
|
||||
|
||||
logDir = "/var/log/httpd";
|
||||
stateDir = "/var/run/httpd";
|
||||
|
||||
subServices = [];
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
name = "httpd";
|
||||
|
||||
job = "
|
||||
description \"Apache HTTPD\"
|
||||
|
||||
start on network-interfaces/started
|
||||
stop on network-interfaces/stop
|
||||
|
||||
start script
|
||||
if ! ${glibc}/bin/getent group ${group} > /dev/null; then
|
||||
${pwdutils}/sbin/groupadd ${group}
|
||||
fi
|
||||
|
||||
if ! ${glibc}/bin/getent passwd ${user} > /dev/null; then
|
||||
${pwdutils}/sbin/useradd -g ${group} -d /var/empty -s /noshell \\
|
||||
-c 'Apache httpd user' ${user}
|
||||
fi
|
||||
end script
|
||||
|
||||
exec ${webServer}/bin/control start
|
||||
";
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user