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;
|
enablePHP = false;
|
||||||
phpOptions = "";
|
phpOptions = "";
|
||||||
options = {};
|
options = {};
|
||||||
|
documentRoot = null;
|
||||||
};
|
};
|
||||||
res = defaults // svcFunction { inherit config pkgs serverInfo php; };
|
res = defaults // svcFunction { inherit config pkgs serverInfo php; };
|
||||||
in res;
|
in res;
|
||||||
@ -188,7 +189,11 @@ let
|
|||||||
|
|
||||||
subservices = callSubservices serverInfo cfg.extraSubservices;
|
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";
|
pkgs.runCommand "empty" {} "ensureDir $out";
|
||||||
|
|
||||||
documentRootConf = ''
|
documentRootConf = ''
|
||||||
@ -240,7 +245,7 @@ let
|
|||||||
|
|
||||||
${robotsConf}
|
${robotsConf}
|
||||||
|
|
||||||
${if isMainServer || cfg.documentRoot != null then documentRootConf else ""}
|
${if isMainServer || maybeDocumentRoot != null then documentRootConf else ""}
|
||||||
|
|
||||||
${if cfg.enableUserDir then ''
|
${if cfg.enableUserDir then ''
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ in
|
|||||||
</Directory>
|
</Directory>
|
||||||
''}
|
''}
|
||||||
|
|
||||||
Alias ${config.urlPrefix} ${mediawikiRoot}
|
${optionalString (config.urlPrefix != "") "Alias ${config.urlPrefix} ${mediawikiRoot}"}
|
||||||
|
|
||||||
<Directory ${mediawikiRoot}>
|
<Directory ${mediawikiRoot}>
|
||||||
Order allow,deny
|
Order allow,deny
|
||||||
@ -139,6 +139,8 @@ in
|
|||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
documentRoot = if config.urlPrefix == "" then mediawikiRoot else null;
|
||||||
|
|
||||||
enablePHP = true;
|
enablePHP = true;
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
Loading…
Reference in New Issue
Block a user