2023-08-22 14:55:56 +02:00
|
|
|
# php pad lister tool written by jonas
|
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
let
|
2023-09-17 20:10:55 +02:00
|
|
|
domain = "list.pad.${config.networking.domain}";
|
2023-08-22 14:55:56 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
services.phpfpm.pools.padlist = {
|
|
|
|
user = "hedgedoc";
|
|
|
|
group = "hedgedoc";
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
phpEnv."PATH" = lib.makeBinPath [ pkgs.php ];
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
virtualHosts.${domain} = {
|
2024-01-05 15:57:32 +01:00
|
|
|
root = "/srv/web/padlist";
|
2023-08-22 14:55:56 +02:00
|
|
|
locations = {
|
|
|
|
"= /" = {
|
|
|
|
extraConfig = ''
|
|
|
|
rewrite ^ /index.php;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
"~ \.php$" = {
|
|
|
|
extraConfig = ''
|
|
|
|
try_files $uri =404;
|
|
|
|
fastcgi_pass unix:${config.services.phpfpm.pools.padlist.socket};
|
2024-01-05 15:57:32 +01:00
|
|
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
2023-08-22 14:55:56 +02:00
|
|
|
fastcgi_index index.php;
|
|
|
|
include ${pkgs.nginx}/conf/fastcgi_params;
|
|
|
|
include ${pkgs.nginx}/conf/fastcgi.conf;
|
2024-01-05 15:57:32 +01:00
|
|
|
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
|
2023-08-22 14:55:56 +02:00
|
|
|
'';
|
|
|
|
};
|
2024-01-05 15:57:32 +01:00
|
|
|
"/vendor".return = "403";
|
2023-08-22 14:55:56 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-05 15:57:32 +01:00
|
|
|
services.portunus.dex.oidcClients = [{
|
|
|
|
id = "padlist";
|
|
|
|
callbackURL = "https://list.pad.ifsr.de/callback.php";
|
|
|
|
}];
|
|
|
|
|
2023-08-22 14:55:56 +02:00
|
|
|
}
|