]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - nixops/modules/websites/ftp/leila.nix
d5c27faadbf131906f01ec08f6e6dbef5e7213cd
[perso/Immae/Config/Nix.git] / nixops / modules / websites / ftp / leila.nix
1 { lib, pkgs, config, ... }:
2 let
3 cfg = config.services.myWebsites.Leila;
4 varDir = "/var/lib/ftp/leila";
5 in {
6 options.services.myWebsites.Leila = {
7 production = {
8 enable = lib.mkEnableOption "enable Leila's website in production";
9 };
10 };
11
12 imports = [
13 ../commons/stats.nix
14 ];
15
16 config = (lib.mkIf cfg.production.enable {
17 security.acme.certs."leila" = config.services.myCertificates.certConfig // {
18 domain = "leila.bouya.org";
19 extraDomains = {
20 "chorale.leila.bouya.org" = null;
21 "chorale-vocanta.fr.nf" = null;
22 "www.chorale-vocanta.fr.nf" = null;
23 };
24 };
25
26 services.myPhpfpm.poolConfigs.leila = ''
27 listen = /run/phpfpm/leila.sock
28 user = wwwrun
29 group = wwwrun
30 listen.owner = wwwrun
31 listen.group = wwwrun
32
33 pm = ondemand
34 pm.max_children = 5
35 pm.process_idle_timeout = 60
36
37 php_admin_value[open_basedir] = "${varDir}:/tmp"
38 '';
39
40 services.myWebsites.commons.stats.enable = true;
41 services.myWebsites.commons.stats.sites = [
42 { name = "leila.bouya.org"; }
43 { name = "chorale.leila.bouya.org"; }
44 ];
45
46 services.myWebsites.production.modules = [ "proxy_fcgi" ];
47 services.myWebsites.production.vhostConfs.leila_chorale = {
48 certName = "leila";
49 hosts = [ "chorale.leila.bouya.org" "chorale-vocanta.fr.nf" "www.chorale-vocanta.fr.nf" ];
50 root = "${varDir}/Chorale";
51 extraConfig = [
52 ''
53 Use Stats chorale.leila.bouya.org
54 <Directory ${varDir}/Chorale>
55 DirectoryIndex index.php index.htm index.html
56 Options Indexes FollowSymLinks MultiViews Includes
57 AllowOverride None
58
59 Use LDAPConnect
60 Require ldap-group cn=chorale.leila.bouya.org,cn=httpd,ou=services,dc=immae,dc=eu
61
62 <FilesMatch "\.php$">
63 SetHandler "proxy:unix:/run/phpfpm/leila.sock|fcgi://localhost"
64 </FilesMatch>
65 </Directory>
66 ''
67 ];
68 };
69 services.myWebsites.production.vhostConfs.leila = {
70 certName = "leila";
71 hosts = [ "leila.bouya.org" ];
72 root = varDir;
73 extraConfig = [
74 ''
75 Use Stats leila.bouya.org
76 <Directory ${varDir}/Chorale>
77 DirectoryIndex index.htm index.html
78 Options Indexes FollowSymLinks MultiViews Includes
79 AllowOverride None
80
81 Use LDAPConnect
82 Require ldap-group cn=chorale.leila.bouya.org,cn=httpd,ou=services,dc=immae,dc=eu
83
84 <FilesMatch "\.php$">
85 SetHandler "proxy:unix:/run/phpfpm/leila.sock|fcgi://localhost"
86 </FilesMatch>
87 </Directory>
88 <Directory ${varDir}>
89 DirectoryIndex index.htm index.html
90 Options Indexes FollowSymLinks MultiViews Includes
91 AllowOverride None
92 Require all granted
93 </Directory>
94 ''
95 ];
96 };
97 });
98 }