mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
owncloud httpd-service: add urlPrefix option
This option allows user to specify a url prefix for owncloud. By default it is set to "" and the document root will be set to owncloud's dir. If a prefix is set, e.g. urlPrefix = "/owncloud" an alias will be created using that prefix to point to owncloud's dir and owncloud will be available at http://localhost/owncloud
This commit is contained in:
parent
a4a334bbe0
commit
e08ffc472c
1 changed files with 14 additions and 7 deletions
|
@ -345,13 +345,12 @@ rec {
|
||||||
|
|
||||||
extraConfig =
|
extraConfig =
|
||||||
''
|
''
|
||||||
ServerName ${config.siteName}
|
${if config.urlPrefix != "" then "Alias ${config.urlPrefix} ${pkgs.owncloud}" else ''
|
||||||
ServerAdmin ${config.adminAddr}
|
|
||||||
DocumentRoot ${documentRoot}
|
|
||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
|
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
|
||||||
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
|
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
|
||||||
|
''}
|
||||||
|
|
||||||
<Directory ${pkgs.owncloud}>
|
<Directory ${pkgs.owncloud}>
|
||||||
${builtins.readFile "${pkgs.owncloud}/.htaccess"}
|
${builtins.readFile "${pkgs.owncloud}/.htaccess"}
|
||||||
|
@ -362,12 +361,20 @@ rec {
|
||||||
{ name = "OC_CONFIG_PATH"; value = "${config.dataDir}/config/"; }
|
{ name = "OC_CONFIG_PATH"; value = "${config.dataDir}/config/"; }
|
||||||
];
|
];
|
||||||
|
|
||||||
documentRoot = pkgs.owncloud;
|
documentRoot = if config.urlPrefix == "" then pkgs.owncloud else null;
|
||||||
|
|
||||||
enablePHP = true;
|
enablePHP = true;
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
|
urlPrefix = mkOption {
|
||||||
|
default = "";
|
||||||
|
example = "/owncloud";
|
||||||
|
description = ''
|
||||||
|
The URL prefix under which the owncloud service appears.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
id = mkOption {
|
id = mkOption {
|
||||||
default = "main";
|
default = "main";
|
||||||
description = ''
|
description = ''
|
||||||
|
|
Loading…
Reference in a new issue