* Apache configuration.

svn path=/nixos/trunk/; revision=7393
This commit is contained in:
Eelco Dolstra 2006-12-18 19:46:48 +00:00
parent 70f929a0a5
commit 9f47929138
4 changed files with 95 additions and 13 deletions

View File

@ -2,7 +2,7 @@
{
name = ["networking" "hostname"];
name = ["networking" "hostName"];
default = "nixos";
description = "The name of the machine.";
}
@ -216,4 +216,80 @@
}
{
name = ["services" "httpd" "user"];
default = "wwwrun";
description = "
User account under which httpd runs. The account is created
automatically if it doesn't exist.
";
}
{
name = ["services" "httpd" "group"];
default = "wwwrun";
description = "
Group under which httpd runs. The account is created
automatically if it doesn't exist.
";
}
{
name = ["services" "httpd" "hostName"];
default = "localhost";
description = "
Canonical hostname for the server.
";
}
{
name = ["services" "httpd" "httpPort"];
default = 80;
description = "
Port for unencrypted HTTP requests.
";
}
{
name = ["services" "httpd" "httpsPort"];
default = 443;
description = "
Port for encrypted HTTP requests.
";
}
{
name = ["services" "httpd" "adminAddr"];
example = "admin@example.org";
description = "
E-mail address of the server administrator.
";
}
{
name = ["services" "httpd" "logDir"];
default = "/var/log/httpd";
description = "
Directory for Apache's log files. It is created automatically.
";
}
{
name = ["services" "httpd" "stateDir"];
default = "/var/run/httpd";
description = "
Directory for Apache's transient runtime state (such as PID
files). It is created automatically. Note that the default,
/var/run/httpd, is deleted at boot time.
";
}
]

View File

@ -172,7 +172,7 @@ rec {
inherit etc;
inherit (pkgs) kernel;
readOnlyRoot = config.get ["boot" "readOnlyRoot"];
hostName = config.get ["networking" "hostname"];
hostName = config.get ["networking" "hostName"];
wrapperDir = setuidWrapper.wrapperDir;
path = [

View File

@ -79,7 +79,7 @@ import ../upstart-jobs/gather.nix {
# Apache httpd.
++ optional ["services" "httpd" "enable"]
(import ../upstart-jobs/httpd.nix {
inherit pkgs;
inherit config pkgs;
inherit (pkgs) glibc pwdutils;
})
@ -104,6 +104,7 @@ import ../upstart-jobs/gather.nix {
# User-defined events.
++ (map makeJob (config.get ["services" "extraJobs"]))
# For the builtin logd job.
# For the built-in logd job.
++ [pkgs.upstart];
}

View File

@ -1,23 +1,26 @@
{pkgs, glibc, pwdutils}:
{config, pkgs, glibc, pwdutils}:
let
user = "wwwrun";
group = "wwwrun";
getCfg = option: config.get ["services" "httpd" option];
user = getCfg "user";
group = getCfg "group";
webServer = import ../services/apache-httpd {
inherit (pkgs) apacheHttpd coreutils;
stdenv = pkgs.stdenvNew;
hostName = "localhost";
httpPort = 80;
hostName = getCfg "hostName";
httpPort = getCfg "httpPort";
httpsPort = getCfg "httpsPort";
inherit user group;
adminAddr = "eelco@cs.uu.nl";
adminAddr = getCfg "adminAddr";
logDir = "/var/log/httpd";
stateDir = "/var/run/httpd";
logDir = getCfg "logDir";
stateDir = getCfg "stateDir";
subServices = [];
};
@ -42,9 +45,11 @@ start script
${pwdutils}/sbin/useradd -g ${group} -d /var/empty -s /noshell \\
-c 'Apache httpd user' ${user}
fi
${webServer}/bin/control prepare
end script
exec ${webServer}/bin/control start
respawn ${webServer}/bin/control run
";
}