]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/websites/leila/production.nix
0ae789374a88ba8a4df97ca88f899b5a0c1a73d9
[perso/Immae/Config/Nix.git] / modules / private / websites / leila / production.nix
1 { lib, pkgs, config, ... }:
2 let
3 cfg = config.myServices.websites.leila.production;
4 varDir = "/var/lib/ftp/leila";
5 apacheUser = config.services.httpd.Prod.user;
6 apacheGroup = config.services.httpd.Prod.group;
7 in {
8 options.myServices.websites.leila.production.enable = lib.mkEnableOption "enable Leila's websites in production";
9
10 config = lib.mkIf cfg.enable {
11 services.phpfpm.pools.leila = {
12 user = apacheUser;
13 group = apacheGroup;
14 settings = {
15 "listen.owner" = apacheUser;
16 "listen.group" = apacheGroup;
17
18 "pm" = "ondemand";
19 "pm.max_children" = "5";
20 "pm.process_idle_timeout" = "60";
21
22 "php_admin_value[open_basedir]" = "${varDir}:/tmp";
23 "php_admin_value[max_execution_time]" = "1800";
24 };
25 phpOptions = config.services.phpfpm.phpOptions + ''
26 disable_functions = "mail"
27 '';
28 phpPackage = pkgs.php72.withExtensions(e: pkgs.php72.enabledExtensions ++ [ e.imagick ]);
29 phpEnv = {
30 PATH = lib.makeBinPath [ pkgs.imagemagick ];
31 };
32 };
33
34 services.webstats.sites = [
35 { name = "leila.bouya.org"; }
36 { name = "chorale.leila.bouya.org"; }
37 { name = "syrwennecreation.bouya.org"; }
38 ];
39
40 services.websites.env.production.modules = [ "proxy_fcgi" ];
41 services.websites.env.production.vhostConfs.leila_chorale = {
42 certName = "leila";
43 addToCerts = true;
44 hosts = [ "chorale.leila.bouya.org" "chorale-vocanta.fr.nf" "www.chorale-vocanta.fr.nf" ];
45 root = "${varDir}/Chorale";
46 extraConfig = [
47 ''
48 Use Stats chorale.leila.bouya.org
49 <Directory ${varDir}/Chorale>
50 DirectoryIndex index.php index.htm index.html
51 Options Indexes FollowSymLinks MultiViews Includes
52 AllowOverride None
53
54 Use LDAPConnect
55 Require ldap-group cn=chorale.leila.bouya.org,cn=httpd,ou=services,dc=immae,dc=eu
56
57 <FilesMatch "\.php$">
58 SetHandler "proxy:unix:${config.services.phpfpm.pools.leila.socket}|fcgi://localhost"
59 </FilesMatch>
60 </Directory>
61 ''
62 ];
63 };
64 services.websites.env.production.vhostConfs.leila_syrwenne = {
65 certName = "leila";
66 addToCerts = true;
67 hosts = [ "syrwennecreation.bouya.org" ];
68 root = "${varDir}/Syrwennecreation";
69 extraConfig = [
70 ''
71 Use Stats syrwennecreation.bouya.org
72 <Directory ${varDir}/Syrwennecreation>
73 DirectoryIndex index.php index.htm index.html
74 Options Indexes FollowSymLinks MultiViews Includes
75 AllowOverride None
76
77 <FilesMatch "\.php$">
78 SetHandler "proxy:unix:${config.services.phpfpm.pools.leila.socket}|fcgi://localhost"
79 </FilesMatch>
80 </Directory>
81 ''
82 ];
83 };
84 services.websites.env.production.vhostConfs.leila = {
85 certName = "leila";
86 certMainHost = "leila.bouya.org";
87 hosts = [ "leila.bouya.org" ];
88 root = varDir;
89 extraConfig = [
90 ''
91 Use Stats leila.bouya.org
92 <Directory ${varDir}/Chorale>
93 DirectoryIndex index.htm index.html
94 Options Indexes FollowSymLinks MultiViews Includes
95 AllowOverride None
96
97 Use LDAPConnect
98 Require ldap-group cn=chorale.leila.bouya.org,cn=httpd,ou=services,dc=immae,dc=eu
99
100 <FilesMatch "\.php$">
101 SetHandler "proxy:unix:${config.services.phpfpm.pools.leila.socket}|fcgi://localhost"
102 </FilesMatch>
103 </Directory>
104 <Directory ${varDir}>
105 DirectoryIndex index.htm index.html
106 Options Indexes FollowSymLinks MultiViews Includes
107 AllowOverride None
108 Require all granted
109 </Directory>
110 ''
111 ];
112 };
113 };
114 }