kanboard: add short domain

This commit is contained in:
Rouven Seifert 2023-10-16 11:59:06 +02:00
parent 94c9be356c
commit ddc7179312
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09

View file

@ -1,5 +1,7 @@
{ pkgs, config, lib, ... }:
let
domain = "kanboard.${config.networking.domain}";
domain_short = "kb.${config.networking.domain}";
user = "kanboard";
group = "kanboard";
in
@ -31,31 +33,38 @@ in
services.nginx.enable = true;
services.nginx.virtualHosts."kanboard.staging.ifsr.de" = {
addSSL = true;
enableACME = true;
root = "/srv/web/kanboard";
extraConfig = ''
index index.html index.php;
'';
locations = {
"/" = {
tryFiles = "$uri $uri/ =404";
};
"~ \.php$" = {
extraConfig = ''
try_files $uri =404;
fastcgi_pass unix:${config.services.phpfpm.pools.kanboard.socket};
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include ${pkgs.nginx}/conf/fastcgi_params;
include ${pkgs.nginx}/conf/fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
'';
};
"/data".return = "403";
services.nginx = {
virtualHosts."${domain_short}" = {
enableACME = true;
forceSSL = true;
locations."/".return = "301 $scheme://${domain}$request_uri";
};
virtualHosts."${domain}" = {
addSSL = true;
enableACME = true;
root = "/srv/web/kanboard";
extraConfig = ''
index index.html index.php;
'';
locations = {
"/" = {
tryFiles = "$uri $uri/ =404";
};
"~ \.php$" = {
extraConfig = ''
try_files $uri =404;
fastcgi_pass unix:${config.services.phpfpm.pools.kanboard.socket};
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include ${pkgs.nginx}/conf/fastcgi_params;
include ${pkgs.nginx}/conf/fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
'';
};
"/data".return = "403";
};
};
};
}