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 =
|
||||
''
|
||||
ServerName ${config.siteName}
|
||||
ServerAdmin ${config.adminAddr}
|
||||
DocumentRoot ${documentRoot}
|
||||
${if config.urlPrefix != "" then "Alias ${config.urlPrefix} ${pkgs.owncloud}" else ''
|
||||
|
||||
RewriteEngine On
|
||||
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
|
||||
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
|
||||
RewriteEngine On
|
||||
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
|
||||
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
|
||||
''}
|
||||
|
||||
<Directory ${pkgs.owncloud}>
|
||||
${builtins.readFile "${pkgs.owncloud}/.htaccess"}
|
||||
|
@ -362,12 +361,20 @@ rec {
|
|||
{ name = "OC_CONFIG_PATH"; value = "${config.dataDir}/config/"; }
|
||||
];
|
||||
|
||||
documentRoot = pkgs.owncloud;
|
||||
documentRoot = if config.urlPrefix == "" then pkgs.owncloud else null;
|
||||
|
||||
enablePHP = true;
|
||||
|
||||
options = {
|
||||
|
||||
urlPrefix = mkOption {
|
||||
default = "";
|
||||
example = "/owncloud";
|
||||
description = ''
|
||||
The URL prefix under which the owncloud service appears.
|
||||
'';
|
||||
};
|
||||
|
||||
id = mkOption {
|
||||
default = "main";
|
||||
description = ''
|
||||
|
|
Loading…
Reference in a new issue