]>
Commit | Line | Data |
---|---|---|
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" = "dynamic"; | |
19 | "pm.max_children" = "20"; | |
20 | "pm.start_servers" = "2"; | |
21 | "pm.min_spare_servers" = "1"; | |
22 | "pm.max_spare_servers" = "3"; | |
23 | ||
24 | "php_admin_value[open_basedir]" = "${varDir}:/tmp"; | |
25 | "php_admin_value[max_execution_time]" = "1800"; | |
26 | }; | |
27 | phpOptions = config.services.phpfpm.phpOptions + '' | |
28 | disable_functions = "mail" | |
29 | ''; | |
30 | phpPackage = pkgs.php72.withExtensions({ enabled, all }: enabled ++ [ all.imagick ]); | |
31 | phpEnv = { | |
32 | PATH = lib.makeBinPath [ pkgs.imagemagick ]; | |
33 | }; | |
34 | }; | |
35 | ||
36 | services.webstats.sites = [ | |
37 | { name = "leila.bouya.org"; } | |
38 | { name = "chorale.leila.bouya.org"; } | |
39 | { name = "syrwennecreation.bouya.org"; } | |
40 | ]; | |
41 | ||
42 | services.websites.env.production.modules = [ "proxy_fcgi" ]; | |
43 | services.websites.env.production.vhostConfs.leila_chorale = { | |
44 | certName = "leila"; | |
45 | addToCerts = true; | |
46 | hosts = [ "chorale.leila.bouya.org" "chorale-vocanta.fr.nf" "www.chorale-vocanta.fr.nf" ]; | |
47 | root = "${varDir}/Chorale"; | |
48 | extraConfig = [ | |
49 | '' | |
50 | Use Stats chorale.leila.bouya.org | |
51 | <Directory ${varDir}/Chorale> | |
52 | DirectoryIndex index.php index.htm index.html | |
53 | Options Indexes FollowSymLinks MultiViews Includes | |
54 | AllowOverride None | |
55 | ||
56 | Use LDAPConnect | |
57 | Require ldap-group cn=chorale.leila.bouya.org,cn=httpd,ou=services,dc=immae,dc=eu | |
58 | ||
59 | <FilesMatch "\.php$"> | |
60 | SetHandler "proxy:unix:${config.services.phpfpm.pools.leila.socket}|fcgi://localhost" | |
61 | </FilesMatch> | |
62 | </Directory> | |
63 | '' | |
64 | ]; | |
65 | }; | |
66 | services.websites.env.production.vhostConfs.leila_syrwenne = { | |
67 | certName = "leila"; | |
68 | addToCerts = true; | |
69 | hosts = [ "syrwennecreation.bouya.org" ]; | |
70 | root = "${varDir}/Syrwennecreation"; | |
71 | extraConfig = [ | |
72 | '' | |
73 | Use Stats syrwennecreation.bouya.org | |
74 | <Directory ${varDir}/Syrwennecreation> | |
75 | DirectoryIndex index.php index.htm index.html | |
76 | Options Indexes FollowSymLinks MultiViews Includes | |
77 | AllowOverride None | |
78 | ||
79 | <FilesMatch "\.php$"> | |
80 | SetHandler "proxy:unix:${config.services.phpfpm.pools.leila.socket}|fcgi://localhost" | |
81 | </FilesMatch> | |
82 | </Directory> | |
83 | '' | |
84 | ]; | |
85 | }; | |
86 | services.websites.env.production.vhostConfs.leila = { | |
87 | certName = "leila"; | |
88 | certMainHost = "leila.bouya.org"; | |
89 | hosts = [ "leila.bouya.org" ]; | |
90 | root = varDir; | |
91 | extraConfig = [ | |
92 | '' | |
93 | Use Stats leila.bouya.org | |
94 | <Directory ${varDir}/Chorale> | |
95 | DirectoryIndex index.htm index.html | |
96 | Options Indexes FollowSymLinks MultiViews Includes | |
97 | AllowOverride None | |
98 | ||
99 | Use LDAPConnect | |
100 | Require ldap-group cn=chorale.leila.bouya.org,cn=httpd,ou=services,dc=immae,dc=eu | |
101 | ||
102 | <FilesMatch "\.php$"> | |
103 | SetHandler "proxy:unix:${config.services.phpfpm.pools.leila.socket}|fcgi://localhost" | |
104 | </FilesMatch> | |
105 | </Directory> | |
106 | <Directory ${varDir}> | |
107 | DirectoryIndex index.htm index.html | |
108 | Options Indexes FollowSymLinks MultiViews Includes | |
109 | AllowOverride None | |
110 | Require all granted | |
111 | </Directory> | |
112 | '' | |
113 | ]; | |
114 | }; | |
115 | }; | |
116 | } |