fruitbasket/modules/kanboard.nix

67 lines
1.7 KiB
Nix
Raw Normal View History

{ pkgs, config, lib, ... }:
2023-10-15 13:38:48 +02:00
let
2023-10-16 11:59:06 +02:00
domain = "kanboard.${config.networking.domain}";
domain_short = "kb.${config.networking.domain}";
user = "kanboard";
group = "kanboard";
2023-10-15 13:38:48 +02:00
in
{
users.users.${user} = {
group = group;
isSystemUser = true;
};
users.groups.${group} = { };
2024-07-22 18:05:07 +02:00
services.phpfpm.pools.kanboard = {
user = "kanboard";
group = "kanboard";
settings = {
"listen.owner" = config.services.nginx.user;
"pm" = "dynamic";
"pm.max_children" = 32;
"pm.max_requests" = 500;
"pm.start_servers" = 2;
"pm.min_spare_servers" = 2;
"pm.max_spare_servers" = 5;
"php_admin_value[error_log]" = "stderr";
"php_admin_flag[log_errors]" = true;
"catch_workers_output" = true;
2024-05-19 11:16:49 +02:00
};
phpEnv."PATH" = lib.makeBinPath [ pkgs.php ];
2024-05-19 11:16:49 +02:00
};
2023-10-15 13:38:48 +02:00
services.nginx.enable = true;
2023-10-16 11:59:06 +02:00
services.nginx = {
virtualHosts."${domain_short}" = {
locations."/".return = "301 $scheme://${domain}$request_uri";
};
2023-10-15 13:38:48 +02:00
2023-10-16 11:59:06 +02:00
virtualHosts."${domain}" = {
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";
2023-10-15 13:38:48 +02:00
};
};
};
}