* 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"; default = "nixos";
description = "The name of the machine."; 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 etc;
inherit (pkgs) kernel; inherit (pkgs) kernel;
readOnlyRoot = config.get ["boot" "readOnlyRoot"]; readOnlyRoot = config.get ["boot" "readOnlyRoot"];
hostName = config.get ["networking" "hostname"]; hostName = config.get ["networking" "hostName"];
wrapperDir = setuidWrapper.wrapperDir; wrapperDir = setuidWrapper.wrapperDir;
path = [ path = [

View File

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

View File

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