]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/christophe_carpentier/website.nix
Cloud Installation for librezo
[perso/Immae/Config/Nix.git] / modules / private / websites / christophe_carpentier / website.nix
CommitLineData
5a412244
IB
1{ lib, config, pkgs, ... }:
2let
3 cfg = config.myServices.websites.christophe_carpentier.website;
4 varDir = "/var/lib/ftp/christophe_carpentier/website";
5 apacheUser = config.services.httpd.Inte.user;
6 apacheGroup = config.services.httpd.Inte.group;
7in {
8 options.myServices.websites.christophe_carpentier.website.enable = lib.mkEnableOption "enable Christophe Carpentier's website";
9
10 config = lib.mkIf cfg.enable {
11 system.activationScripts.christophe_carpentier_website = {
12 deps = [ "httpd" "users" ];
13 text = ''
14 install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d ${varDir}
15 install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/christophe_carpentier
16 '';
17 };
18 services.phpfpm.pools.christophe_carpentier_website = {
19 user = apacheUser;
20 group = apacheGroup;
21 settings = {
22 "listen.owner" = apacheUser;
23 "listen.group" = apacheGroup;
24
25 "pm" = "ondemand";
26 "pm.max_children" = "5";
27 "pm.process_idle_timeout" = "60";
28
29 "php_admin_value[open_basedir]" = "/var/lib/php/sessions/christophe_carpentier:${varDir}:/tmp";
30 "php_admin_value[session.save_path]" = "/var/lib/php/sessions/christophe_carpentier";
31 };
32 phpOptions = config.services.phpfpm.phpOptions + ''
33 disable_functions = "mail"
34 '';
35 phpPackage = pkgs.php72;
36 };
37 services.websites.env.production.modules = [ "proxy_fcgi" ];
38 services.websites.env.integration.vhostConfs.christophe_carpentier_website = {
39 certName = "integration";
40 addToCerts = true;
41 hosts = ["www.cc.immae.dev" "cc.immae.dev"];
42 root = varDir;
43 extraConfig = [
44 ''
45 <FilesMatch "\.php$">
46 SetHandler "proxy:unix:${config.services.phpfpm.pools.christophe_carpentier_website.socket}|fcgi://localhost"
47 </FilesMatch>
48
49 <Directory ${varDir}>
50 DirectoryIndex index.php index.htm index.html
51 Options Indexes FollowSymLinks MultiViews Includes
52 AllowOverride All
53 Require all granted
54 </Directory>
55 ''
56 ];
57 };
58 };
59}
60