]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/websites/leila/production.nix
b48da6ff57ec773061d96b832ced21af33691013
[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 };
24 };
25
26 services.webstats.sites = [
27 { name = "leila.bouya.org"; }
28 { name = "chorale.leila.bouya.org"; }
29 { name = "syrwennecreation.bouya.org"; }
30 ];
31
32 services.websites.env.production.modules = [ "proxy_fcgi" ];
33 services.websites.env.production.vhostConfs.leila_chorale = {
34 certName = "leila";
35 addToCerts = true;
36 hosts = [ "chorale.leila.bouya.org" "chorale-vocanta.fr.nf" "www.chorale-vocanta.fr.nf" ];
37 root = "${varDir}/Chorale";
38 extraConfig = [
39 ''
40 Use Stats chorale.leila.bouya.org
41 <Directory ${varDir}/Chorale>
42 DirectoryIndex index.php index.htm index.html
43 Options Indexes FollowSymLinks MultiViews Includes
44 AllowOverride None
45
46 Use LDAPConnect
47 Require ldap-group cn=chorale.leila.bouya.org,cn=httpd,ou=services,dc=immae,dc=eu
48
49 <FilesMatch "\.php$">
50 SetHandler "proxy:unix:${config.services.phpfpm.pools.leila.socket}|fcgi://localhost"
51 </FilesMatch>
52 </Directory>
53 ''
54 ];
55 };
56 services.websites.env.production.vhostConfs.leila_syrwenne = {
57 certName = "leila";
58 addToCerts = true;
59 hosts = [ "syrwennecreation.bouya.org" ];
60 root = "${varDir}/Syrwennecreation";
61 extraConfig = [
62 ''
63 Use Stats syrwennecreation.bouya.org
64 <Directory ${varDir}/Syrwennecreation>
65 DirectoryIndex index.php index.htm index.html
66 Options Indexes FollowSymLinks MultiViews Includes
67 AllowOverride None
68
69 <FilesMatch "\.php$">
70 SetHandler "proxy:unix:${config.services.phpfpm.pools.leila.socket}|fcgi://localhost"
71 </FilesMatch>
72 </Directory>
73 ''
74 ];
75 };
76 services.websites.env.production.vhostConfs.leila = {
77 certName = "leila";
78 certMainHost = "leila.bouya.org";
79 hosts = [ "leila.bouya.org" ];
80 root = varDir;
81 extraConfig = [
82 ''
83 Use Stats leila.bouya.org
84 <Directory ${varDir}/Chorale>
85 DirectoryIndex index.htm index.html
86 Options Indexes FollowSymLinks MultiViews Includes
87 AllowOverride None
88
89 Use LDAPConnect
90 Require ldap-group cn=chorale.leila.bouya.org,cn=httpd,ou=services,dc=immae,dc=eu
91
92 <FilesMatch "\.php$">
93 SetHandler "proxy:unix:${config.services.phpfpm.pools.leila.socket}|fcgi://localhost"
94 </FilesMatch>
95 </Directory>
96 <Directory ${varDir}>
97 DirectoryIndex index.htm index.html
98 Options Indexes FollowSymLinks MultiViews Includes
99 AllowOverride None
100 Require all granted
101 </Directory>
102 ''
103 ];
104 };
105 };
106 }