forked from pub-solar/os
fix: invoiceplane nginx config
Co-authored-by: b12f <b12f@noreply.git.pub.solar>
This commit is contained in:
parent
6a46d98662
commit
dd275ebb6d
|
@ -241,7 +241,7 @@ in
|
|||
};
|
||||
|
||||
options.webserver = mkOption {
|
||||
type = types.enum [ "caddy" ];
|
||||
type = types.enum [ "caddy" "nginx" ];
|
||||
default = "caddy";
|
||||
description = lib.mdDoc ''
|
||||
Which webserver to use for virtual host management. Currently only
|
||||
|
@ -373,5 +373,39 @@ in
|
|||
};
|
||||
})
|
||||
|
||||
(mkIf (cfg.webserver == "nginx") {
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts = mapAttrs' (hostName: cfg: (
|
||||
nameValuePair "${hostName}" {
|
||||
root = "${pkg hostName cfg}";
|
||||
extraConfig = ''
|
||||
index index.php index.html index.htm;
|
||||
|
||||
if (!-e $request_filename){
|
||||
rewrite ^(.*)$ /index.php break;
|
||||
}
|
||||
'';
|
||||
|
||||
locations = {
|
||||
"/setup".extraConfig = ''
|
||||
rewrite ^(.*)$ http://${hostName}/ redirect;
|
||||
'';
|
||||
|
||||
"~ .php$" = {
|
||||
extraConfig = ''
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools."invoiceplane-${hostName}".socket};
|
||||
include ${pkgs.nginx}/conf/fastcgi_params;
|
||||
include ${pkgs.nginx}/conf/fastcgi.conf;
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
)) eachSite;
|
||||
};
|
||||
})
|
||||
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue