1 # This file defines the options that can be used both for the Apache
2 # main server configuration, and for the virtual hosts. (The latter
3 # has additional options that affect the web server as a whole, like
4 # the user/group to run under.)
6 { forMainServer, lib }:
14 default = "localhost";
15 description = "Canonical hostname for the server.";
18 serverAliases = mkOption {
19 type = types.listOf types.str;
21 example = ["www.example.org" "www.example.org:8080" "example.org"];
23 Additional names of virtual hosts served by this virtual host configuration.
31 Port for the server. Option will be removed, use <option>listen</option> instead.
36 type = types.listOf (types.submodule (
41 description = "port to listen on";
46 description = "Ip to listen on. 0.0.0.0 for ipv4 only, * for all.";
51 List of { /* ip: "*"; */ port = 80;} to listen on
57 enableSSL = mkOption {
60 description = "Whether to enable SSL (https) support.";
63 # Note: sslServerCert and sslServerKey can be left empty, but this
64 # only makes sense for virtual hosts (they will inherit from the
67 sslServerCert = mkOption {
68 type = types.nullOr types.path;
70 example = "/var/host.cert";
71 description = "Path to server SSL certificate.";
74 sslServerKey = mkOption {
76 example = "/var/host.key";
77 description = "Path to server SSL certificate key.";
80 sslServerChain = mkOption {
81 type = types.nullOr types.path;
83 example = "/var/ca.pem";
84 description = "Path to server SSL chain file.";
87 adminAddr = mkOption ({
88 type = types.nullOr types.str;
89 example = "admin@example.org";
90 description = "E-mail address of the server administrator.";
91 } // (if forMainServer then {} else {default = null;}));
93 documentRoot = mkOption {
94 type = types.nullOr types.path;
96 example = "/data/webserver/docs";
98 The path of Apache's document root directory. If left undefined,
99 an empty directory in the Nix store will be used as root.
103 servedDirs = mkOption {
104 type = types.listOf types.attrs;
108 dir = "/home/eelco/Dev/nix-homepage";
112 This option provides a simple way to serve static directories.
116 servedFiles = mkOption {
117 type = types.listOf types.attrs;
120 { urlPath = "/foo/bar.png";
121 file = "/home/eelco/some-file.png";
125 This option provides a simple way to serve individual, static files.
129 extraConfig = mkOption {
134 Options FollowSymlinks
139 These lines go to httpd.conf verbatim. They will go after
140 directories and directory aliases defined by default.
144 extraSubservices = mkOption {
145 type = types.listOf types.unspecified;
147 description = "Extra subservices to enable in the webserver.";
150 enableUserDir = mkOption {
154 Whether to enable serving <filename>~/public_html</filename> as
155 <literal>/~<replaceable>username</replaceable></literal>.
159 globalRedirect = mkOption {
160 type = types.nullOr types.str;
162 example = http://newserver.example.org/;
164 If set, all requests for this host are redirected permanently to
169 logFormat = mkOption {
172 example = "combined";
174 Log format for Apache's log files. Possible values are: combined, common, referer, agent.
178 robotsEntries = mkOption {
181 example = "Disallow: /foo/";
183 Specification of pages to be ignored by web crawlers. See <link
184 xlink:href='http://www.robotstxt.org/'/> for details.