{ lib, pkgs, config, ... }:
let
secrets = config.myEnv.websites.chloe.new;
cfg = config.myServices.websites.chloe.new;
ftpRoot = "/var/lib/chloe_new";
webRoot = "${ftpRoot}/wordpress";
sessionDir = "${ftpRoot}/sessions";
in {
options.myServices.websites.chloe.new.enable = lib.mkEnableOption "enable Chloe's new website in integration";
config = lib.mkIf cfg.enable {
services.phpfpm.pools.chloe_new_integration = {
user = config.services.httpd.Inte.user;
group = config.services.httpd.Inte.group;
settings = {
"listen.owner" = config.services.httpd.Inte.user;
"listen.group" = config.services.httpd.Inte.group;
"php_admin_value[open_basedir]" = builtins.concatStringsSep ":" [
webRoot
sessionDir
"/tmp"
];
"php_admin_value[session.save_path]" = sessionDir;
"php_admin_value[upload_max_filesize]" = "20M";
"php_admin_value[post_max_size]" = "20M";
#"php_admin_flag[log_errors]" = "on";
"pm" = "ondemand";
"pm.max_children" = "5";
"pm.process_idle_timeout" = "60";
};
phpPackage = pkgs.php74;
};
system.activationScripts.chloe_new_integration = {
deps = ["users"];
text = ''
install -m 0700 -o ${config.services.httpd.Inte.user} -g ${config.services.httpd.Inte.group} -d ${ftpRoot} ${sessionDir}
'';
};
services.websites.env.integration.vhostConfs.chloe_new_integration = {
certName = "integration";
addToCerts = true;
hosts = [ "new.chc.immae.dev" ];
root = webRoot;
extraConfig = [
''
SetHandler "proxy:unix:${config.services.phpfpm.pools.chloe_new_integration.socket}|fcgi://localhost"
Use LDAPConnect
Require ldap-group cn=chc.immae.dev,cn=httpd,ou=services,dc=immae,dc=eu
AllowOverride None
Require all denied
DirectoryIndex index.php index.htm index.html
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride all
Require all granted
''
];
};
};
}