mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
Give types to the Apache httpd options
This commit is contained in:
parent
0afdb1e933
commit
985f1f2d8a
2 changed files with 90 additions and 75 deletions
|
@ -30,7 +30,7 @@ let
|
|||
|
||||
# Admin address: inherit from the main server if not specified for
|
||||
# a virtual host.
|
||||
adminAddr = if cfg.adminAddr != "" then cfg.adminAddr else mainCfg.adminAddr;
|
||||
adminAddr = if cfg.adminAddr != null then cfg.adminAddr else mainCfg.adminAddr;
|
||||
|
||||
vhostConfig = cfg;
|
||||
serverConfig = mainCfg;
|
||||
|
@ -217,7 +217,7 @@ let
|
|||
|
||||
${concatMapStrings (alias: "ServerAlias ${alias}\n") cfg.serverAliases}
|
||||
|
||||
${if cfg.sslServerCert != "" then ''
|
||||
${if cfg.sslServerCert != null then ''
|
||||
SSLCertificateFile ${cfg.sslServerCert}
|
||||
SSLCertificateKeyFile ${cfg.sslServerKey}
|
||||
'' else ""}
|
||||
|
@ -229,7 +229,7 @@ let
|
|||
SSLEngine off
|
||||
'' else ""}
|
||||
|
||||
${if isMainServer || cfg.adminAddr != "" then ''
|
||||
${if isMainServer || cfg.adminAddr != null then ''
|
||||
ServerAdmin ${cfg.adminAddr}
|
||||
'' else ""}
|
||||
|
||||
|
@ -260,7 +260,7 @@ let
|
|||
|
||||
'' else ""}
|
||||
|
||||
${if cfg.globalRedirect != "" then ''
|
||||
${if cfg.globalRedirect != null then ''
|
||||
RedirectPermanent / ${cfg.globalRedirect}
|
||||
'' else ""}
|
||||
|
||||
|
@ -408,96 +408,104 @@ in
|
|||
services.httpd = {
|
||||
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "
|
||||
Whether to enable the Apache httpd server.
|
||||
";
|
||||
description = "Whether to enable the Apache HTTP Server.";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.path;
|
||||
default = pkgs.apacheHttpd.override { mpm = mainCfg.multiProcessingModule; };
|
||||
example = "pkgs.apacheHttpd_2_4";
|
||||
description = "
|
||||
description = ''
|
||||
Overridable attribute of the Apache HTTP Server package to use.
|
||||
";
|
||||
'';
|
||||
};
|
||||
|
||||
configFile = mkOption {
|
||||
type = types.path;
|
||||
default = confFile;
|
||||
example = literalExample ''pkgs.writeText "httpd.conf" "# my custom config file ...";'';
|
||||
description = "
|
||||
Overridable config file to use for Apache. By default, use the
|
||||
file automatically generated by nixos.
|
||||
";
|
||||
description = ''
|
||||
Override the configuration file used by Apache. By default,
|
||||
NixOS generates one automatically.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = "
|
||||
These configuration lines will be appended to the Apache config
|
||||
file. Note that this mechanism may not work when <option>configFile</option>
|
||||
is overridden.
|
||||
";
|
||||
description = ''
|
||||
Cnfiguration lines appended to the generated Apache
|
||||
configuration file. Note that this mechanism may not work
|
||||
when <option>configFile</option> is overridden.
|
||||
'';
|
||||
};
|
||||
|
||||
extraModules = mkOption {
|
||||
type = types.listOf types.unspecified;
|
||||
default = [];
|
||||
example = [ "proxy_connect" { name = "php5"; path = "${php}/modules/libphp5.so"; } ];
|
||||
description = ''
|
||||
Specifies additional Apache modules. These can be specified
|
||||
as a string in the case of modules distributed with Apache,
|
||||
or as an attribute set specifying the
|
||||
Additional Apache modules to be used. These can be
|
||||
specified as a string in the case of modules distributed
|
||||
with Apache, or as an attribute set specifying the
|
||||
<varname>name</varname> and <varname>path</varname> of the
|
||||
module.
|
||||
'';
|
||||
};
|
||||
|
||||
logPerVirtualHost = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "
|
||||
description = ''
|
||||
If enabled, each virtual host gets its own
|
||||
<filename>access_log</filename> and
|
||||
<filename>error_log</filename>, namely suffixed by the
|
||||
<option>hostName</option> of the virtual host.
|
||||
";
|
||||
'';
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "wwwrun";
|
||||
description = "
|
||||
description = ''
|
||||
User account under which httpd runs. The account is created
|
||||
automatically if it doesn't exist.
|
||||
";
|
||||
'';
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
default = "wwwrun";
|
||||
description = "
|
||||
description = ''
|
||||
Group under which httpd runs. The account is created
|
||||
automatically if it doesn't exist.
|
||||
";
|
||||
'';
|
||||
};
|
||||
|
||||
logDir = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/log/httpd";
|
||||
description = "
|
||||
description = ''
|
||||
Directory for Apache's log files. It is created automatically.
|
||||
";
|
||||
'';
|
||||
};
|
||||
|
||||
stateDir = mkOption {
|
||||
default = "/var/run/httpd";
|
||||
description = "
|
||||
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>/var/run/httpd</filename>, is deleted at boot time.
|
||||
";
|
||||
<filename>/run/httpd</filename>, is deleted at boot time.
|
||||
'';
|
||||
};
|
||||
|
||||
virtualHosts = mkOption {
|
||||
type = types.listOf (types.submodule (
|
||||
{ options = import ./per-server-options.nix {
|
||||
inherit mkOption;
|
||||
inherit pkgs;
|
||||
forMainServer = false;
|
||||
};
|
||||
}));
|
||||
|
@ -519,6 +527,7 @@ in
|
|||
};
|
||||
|
||||
phpOptions = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example =
|
||||
''
|
||||
|
@ -529,9 +538,9 @@ in
|
|||
};
|
||||
|
||||
multiProcessingModule = mkOption {
|
||||
type = types.str;
|
||||
default = "prefork";
|
||||
example = "worker";
|
||||
type = types.uniq types.string;
|
||||
description =
|
||||
''
|
||||
Multi-processing module to be used by Apache. Available
|
||||
|
@ -546,12 +555,14 @@ in
|
|||
};
|
||||
|
||||
maxClients = mkOption {
|
||||
type = types.int;
|
||||
default = 150;
|
||||
example = 8;
|
||||
description = "Maximum number of httpd processes (prefork)";
|
||||
};
|
||||
|
||||
maxRequestsPerChild = mkOption {
|
||||
type = types.int;
|
||||
default = 0;
|
||||
example = 500;
|
||||
description =
|
||||
|
@ -561,7 +572,7 @@ in
|
|||
|
||||
# Include the options shared between the main server and virtual hosts.
|
||||
// (import ./per-server-options.nix {
|
||||
inherit mkOption;
|
||||
inherit pkgs;
|
||||
forMainServer = true;
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue