mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 07:53:19 +00:00
Allow httpd subservices to set the document root
Only the main service OR one of the subservices can set the document root. This is used by mediawiki when it is hosted at the root of the vhost.
This commit is contained in:
parent
ec09c7d34e
commit
0d4a9e3aa6
@ -63,6 +63,7 @@ let
|
||||
enablePHP = false;
|
||||
phpOptions = "";
|
||||
options = {};
|
||||
documentRoot = null;
|
||||
};
|
||||
res = defaults // svcFunction { inherit config pkgs serverInfo php; };
|
||||
in res;
|
||||
@ -188,7 +189,11 @@ let
|
||||
|
||||
subservices = callSubservices serverInfo cfg.extraSubservices;
|
||||
|
||||
documentRoot = if cfg.documentRoot != null then cfg.documentRoot else
|
||||
maybeDocumentRoot = fold (svc: acc:
|
||||
if acc == null then svc.documentRoot else assert svc.documentRoot == null; acc
|
||||
) null ([ cfg ] ++ subservices);
|
||||
|
||||
documentRoot = if maybeDocumentRoot != null then maybeDocumentRoot else
|
||||
pkgs.runCommand "empty" {} "ensureDir $out";
|
||||
|
||||
documentRootConf = ''
|
||||
@ -240,7 +245,7 @@ let
|
||||
|
||||
${robotsConf}
|
||||
|
||||
${if isMainServer || cfg.documentRoot != null then documentRootConf else ""}
|
||||
${if isMainServer || maybeDocumentRoot != null then documentRootConf else ""}
|
||||
|
||||
${if cfg.enableUserDir then ''
|
||||
|
||||
|
@ -126,7 +126,7 @@ in
|
||||
</Directory>
|
||||
''}
|
||||
|
||||
Alias ${config.urlPrefix} ${mediawikiRoot}
|
||||
${optionalString (config.urlPrefix != "") "Alias ${config.urlPrefix} ${mediawikiRoot}"}
|
||||
|
||||
<Directory ${mediawikiRoot}>
|
||||
Order allow,deny
|
||||
@ -139,6 +139,8 @@ in
|
||||
''}
|
||||
'';
|
||||
|
||||
documentRoot = if config.urlPrefix == "" then mediawikiRoot else null;
|
||||
|
||||
enablePHP = true;
|
||||
|
||||
options = {
|
||||
|
Loading…
Reference in New Issue
Block a user