1 { lib, pkgs, config, ... }:
4 theme_root = pkgs.webapps.apache-theme.theme;
7 # This setting permits to ignore time-based cache for files in the
9 # If a client requires an If-Modified-Since from timestamp 1, then
10 # this header is removed, and if the response contains a
11 # too old Last-Modified tag, then it is removed too
13 <If "%{HTTP:If-Modified-Since} =~ /01 Jan 1970 00:00:01/" >
14 RequestHeader unset If-Modified-Since
16 Header unset Last-Modified "expr=%{LAST_MODIFIED} < 19991231235959"
20 modules = [ "deflate" "filter" ];
22 AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
26 modules = [ "macro" ];
30 <Macro Stats %{domain}>
31 Alias /webstats ${config.services.webstats.dataDir}/%{domain}
32 <Directory ${config.services.webstats.dataDir}/%{domain}>
33 DirectoryIndex index.html
39 Require ldap-group cn=%{domain},ou=stats,cn=httpd,ou=services,dc=immae,dc=eu
45 modules = [ "ldap" "authnz_ldap" ];
47 <IfModule ldap_module>
48 LDAPSharedCacheSize 500000
51 LDAPOpCacheEntries 1024
55 Include ${config.secrets.fullPaths."apache-ldap"}
60 ErrorDocument 500 /maintenance_immae.html
61 ErrorDocument 501 /maintenance_immae.html
62 ErrorDocument 502 /maintenance_immae.html
63 ErrorDocument 503 /maintenance_immae.html
64 ErrorDocument 504 /maintenance_immae.html
65 Alias /maintenance_immae.html ${www_root}/maintenance_immae.html
66 ProxyPass /maintenance_immae.html !
68 AliasMatch "(.*)/googleb6d69446ff4ca3e5.html" ${www_root}/googleb6d69446ff4ca3e5.html
69 <Directory ${www_root}>
76 extraConfig = (pkgs.webapps.apache-theme.override { inherit theme_root; }).apacheConfig;
79 modules = [ "http2" ];
86 LogFormat "%{Host}i:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedVhost
90 makeModules = lib.lists.flatten (lib.attrsets.mapAttrsToList (n: v: v.modules or []) apacheConfig);
91 makeExtraConfig = (builtins.filter (x: x != null) (lib.attrsets.mapAttrsToList (n: v: v.extraConfig or null) apacheConfig));
93 lines = lib.splitString "\n" (lib.fileContents ./moomin.txt);
95 padWidth = width - lib.stringLength str;
96 padding = lib.concatStrings (lib.genList (lib.const "0") padWidth);
97 in lib.optionalString (padWidth > 0) padding + str;
99 lib.imap0 (i: e: ''Header always set "X-Moomin-${pad 2 (builtins.toString i)}" "${e}"'') lines;
102 options.myServices.websites.enable = lib.mkEnableOption "enable websites";
104 config = lib.mkIf config.myServices.websites.enable {
105 myServices.chatonsProperties.hostings.web = {
106 file.datetime = "2022-08-22T01:30:00";
108 name = "Hébergement Web";
109 description = "Service d'hébergement web avec php/mysql/postgresql";
110 website = "https://www.immae.eu";
112 status.description = "OK";
113 registration.load = "OPEN";
114 install.type = "PACKAGE";
117 name = "Apache Httpd";
118 website = "https://httpd.apache.org/";
119 license.url = "https://www.apache.org/licenses/";
120 license.name = "Apache License Version 2";
121 version = pkgs.apacheHttpd.version;
122 source.url = "https://httpd.apache.org/download.cgi";
123 modules = "openssh,pure-ftpd";
126 users.users.wwwrun.extraGroups = [ "keys" ];
127 networking.firewall.allowedTCPPorts = [ 80 443 ];
129 secrets.keys."apache-ldap" = {
132 permissions = "0400";
135 <IfModule authnz_ldap_module>
136 AuthLDAPURL ldap://ldap.immae.eu:389/dc=immae,dc=eu STARTTLS
137 AuthLDAPBindDN cn=httpd,ou=services,dc=immae,dc=eu
138 AuthLDAPBindPassword "${config.myEnv.httpd.ldap.password}"
140 AuthName "Authentification requise (Acces LDAP)"
141 AuthBasicProvider ldap
147 system.activationScripts = {
149 install -d -m 0755 /var/lib/acme/acme-challenges
150 install -d -m 0750 -o wwwrun -g wwwrun /var/lib/php/sessions
156 session.save_path = "/var/lib/php/sessions"
159 session.gc_maxlifetime = 1296000
161 session.cache_expire = 43200
164 log_level = "notice";
168 services.filesWatcher.httpdProd.paths = [ config.secrets.fullPaths."apache-ldap" ];
169 services.filesWatcher.httpdInte.paths = [ config.secrets.fullPaths."apache-ldap" ];
170 services.filesWatcher.httpdTools.paths = [ config.secrets.fullPaths."apache-ldap" ];
172 services.websites.env.production = {
174 adminAddr = "httpd@immae.eu";
177 let ips = config.myEnv.servers.eldiron.ips.production;
178 in (ips.ip4 or []) ++ (ips.ip6 or []);
179 modules = makeModules;
180 extraConfig = makeExtraConfig;
182 certName = "eldiron";
183 hosts = ["eldiron.immae.eu" ];
185 extraConfig = [ "DirectoryIndex index.htm" ];
189 services.websites.env.integration = {
191 adminAddr = "httpd@immae.eu";
194 let ips = config.myEnv.servers.eldiron.ips.integration;
195 in (ips.ip4 or []) ++ (ips.ip6 or []);
196 modules = makeModules;
197 extraConfig = makeExtraConfig ++ moomin;
199 certName = "integration";
200 hosts = ["eldiron.immae.eu" ];
202 extraConfig = [ "DirectoryIndex index.htm" ];
206 services.websites.env.tools = {
208 adminAddr = "httpd@immae.eu";
211 let ips = config.myEnv.servers.eldiron.ips.main;
212 in (ips.ip4 or []) ++ (ips.ip6 or []);
213 modules = makeModules;
214 extraConfig = makeExtraConfig ++
216 RedirectMatch ^/licen[cs]es?_et_tip(ping)?$ https://www.immae.eu/licences_et_tip.html
217 RedirectMatch ^/licen[cs]es?_and_tip(ping)?$ https://www.immae.eu/licenses_and_tipping.html
218 RedirectMatch ^/licen[cs]es?$ https://www.immae.eu/licenses_and_tipping.html
219 RedirectMatch ^/tip(ping)?$ https://www.immae.eu/licenses_and_tipping.html
220 RedirectMatch ^/(mentions|mentions_legales|legal)$ https://www.immae.eu/mentions.html
221 RedirectMatch ^/CGU$ https://www.immae.eu/CGU
226 host = "nossl.immae.eu";
229 certName = "eldiron";
230 hosts = ["eldiron.immae.eu" ];
232 extraConfig = [ "DirectoryIndex index.htm" ];
236 myServices.tools.kanboard.farm.instances.tonnelle = {};
237 myServices.tools.kanboard.farm.instances.gebull = {};
238 myServices.websites = {
239 attilax.dolibarr.enable = true;
241 bakeer.cloud.enable = true;
242 capitaines.landing_pages.enable = true;
246 production.enable = true;
249 christophe_carpentier = {
250 website.enable = true;
251 agorakit.enable = true;
252 agora-project.enable = true;
260 integration.enable = true;
261 production.enable = true;
265 evariste.enable = true;
266 denisejerome.enable = true;
269 aventuriers.enable = true;
270 production.enable = true;
274 moodle.enable = false;
275 atelierfringant.enable = false;
280 integration.enable = true;
281 production.enable = true;
285 production.enable = true;
286 release.enable = true;
288 dolibarr.enable = true;
292 aten_integration.enable = true;
293 aten_production.enable = true;
294 iridologie.enable = true;
297 jerome.naturaloutil.enable = true;
299 leila.production.enable = true;
303 dolibarr.enable = true;
304 dolibarrDev.enable = true;
305 website.enable = true;
309 integration.enable = true;
310 production.enable = true;
313 nassime.production.enable = true;
316 gestion-compte.enable = true;
317 gestion-compte-integration.enable = true;
319 dolibarrDev.enable = true;
320 copanier.enable = true;
328 surveillance.enable = true;
329 maison_bbc.enable = true;
333 ecolyeu.enable = false;
334 altermondia.enable = true;
338 integration.enable = true;
339 production.enable = true;
342 ressourcerie_banon.production.enable = true;
343 ressourcerie_banon.cryptpad.enable = true;
344 ressourcerie_banon.cloud.enable = true;
346 richie.production.enable = true;
348 syden.peertube.enable = true;
350 telio_tortay.production.enable = true;
352 tools.assets.enable = true;
353 tools.cloud.enable = true;
354 tools.commento.enable = true;
355 tools.cryptpad.enable = true;
356 tools.dav.enable = true;
357 tools.db.enable = true;
358 tools.diaspora.enable = true;
359 tools.etherpad-lite.enable = true;
360 tools.git.enable = true;
361 tools.mastodon.enable = true;
362 tools.mediagoblin.enable = true;
363 tools.peertube.enable = true;
364 tools.performance.enable = true;
365 tools.tools.enable = true;
366 tools.email.enable = true;
367 tools.stats.enable = false;
368 tools.visio.enable = true;
370 games.codenames.enable = true;
371 games.terraforming-mars.enable = true;