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