1 { lib, pkgs, config, ... }:
3 www_root = "/run/current-system/webapps/_www";
4 theme_root = "/run/current-system/webapps/_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 /var/secrets/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 services.duplyBackup.profiles.php = {
106 rootDir = "/var/lib/php";
107 remotes = [ "eriomem" "ovh" ];
109 users.users.wwwrun.extraGroups = [ "keys" ];
110 networking.firewall.allowedTCPPorts = [ 80 443 ];
113 dest = "apache-ldap";
116 permissions = "0400";
119 <IfModule authnz_ldap_module>
120 AuthLDAPURL ldap://ldap.immae.eu:389/dc=immae,dc=eu STARTTLS
121 AuthLDAPBindDN cn=httpd,ou=services,dc=immae,dc=eu
122 AuthLDAPBindPassword "${config.myEnv.httpd.ldap.password}"
124 AuthName "Authentification requise (Acces LDAP)"
125 AuthBasicProvider ldap
131 system.activationScripts = {
133 install -d -m 0755 /var/lib/acme/acme-challenges
134 install -d -m 0750 -o wwwrun -g wwwrun /var/lib/php/sessions
140 session.save_path = "/var/lib/php/sessions"
143 session.gc_maxlifetime = 1296000
145 session.cache_expire = 43200
148 log_level = "notice";
152 services.filesWatcher.httpdProd.paths = [ "/var/secrets/apache-ldap" ];
153 services.filesWatcher.httpdInte.paths = [ "/var/secrets/apache-ldap" ];
154 services.filesWatcher.httpdTools.paths = [ "/var/secrets/apache-ldap" ];
156 services.websites.env.production = {
158 adminAddr = "httpd@immae.eu";
161 let ips = config.myEnv.servers.eldiron.ips.production;
162 in [ips.ip4] ++ (ips.ip6 or []);
163 modules = makeModules;
164 extraConfig = makeExtraConfig;
166 certName = "eldiron";
167 hosts = ["eldiron.immae.eu" ];
169 extraConfig = [ "DirectoryIndex index.htm" ];
173 services.websites.env.integration = {
175 adminAddr = "httpd@immae.eu";
178 let ips = config.myEnv.servers.eldiron.ips.integration;
179 in [ips.ip4] ++ (ips.ip6 or []);
180 modules = makeModules;
181 extraConfig = makeExtraConfig ++ moomin;
183 certName = "eldiron";
184 hosts = ["eldiron.immae.eu" ];
186 extraConfig = [ "DirectoryIndex index.htm" ];
190 services.websites.env.tools = {
192 adminAddr = "httpd@immae.eu";
195 let ips = config.myEnv.servers.eldiron.ips.main;
196 in [ips.ip4] ++ (ips.ip6 or []);
197 modules = makeModules;
198 extraConfig = makeExtraConfig ++
200 RedirectMatch ^/licen[cs]es?_et_tip(ping)?$ https://www.immae.eu/licences_et_tip.html
201 RedirectMatch ^/licen[cs]es?_and_tip(ping)?$ https://www.immae.eu/licenses_and_tipping.html
202 RedirectMatch ^/licen[cs]es?$ https://www.immae.eu/licenses_and_tipping.html
203 RedirectMatch ^/tip(ping)?$ https://www.immae.eu/licenses_and_tipping.html
204 RedirectMatch ^/(mentions|mentions_legales|legal)$ https://www.immae.eu/mentions.html
205 RedirectMatch ^/CGU$ https://www.immae.eu/CGU
210 host = "nossl.immae.eu";
213 certName = "eldiron";
214 hosts = ["eldiron.immae.eu" ];
216 extraConfig = [ "DirectoryIndex index.htm" ];
220 services.websites.webappDirs = {
222 _theme = pkgs.webapps.apache-theme.theme;
224 myServices.websites = {
225 capitaines.landing_pages.enable = true;
228 integration.enable = true;
229 production.enable = true;
237 integration.enable = true;
238 production.enable = true;
242 evariste.enable = true;
243 denisejerome.enable = true;
245 aventuriers.enable = true;
246 production.enable = true;
249 emilia.moodle.enable = false;
253 integration.enable = true;
254 production.enable = true;
258 production.enable = true;
259 release.enable = true;
264 aten_integration.enable = true;
265 aten_production.enable = true;
266 iridologie.enable = true;
269 jerome.naturaloutil.enable = true;
271 leila.production.enable = true;
274 integration.enable = true;
275 production.enable = true;
278 nassime.production.enable = true;
280 nathanael.villon.enable = true;
283 surveillance.enable = true;
284 maison_bbc.enable = true;
287 patrick_fodella.production.enable = true;
290 integration.enable = true;
291 production.enable = true;
294 richie.production.enable = true;
296 syden.peertube.enable = true;
298 telio_tortay.production.enable = true;
300 tools.assets.enable = true;
301 tools.cloud.enable = true;
302 tools.commento.enable = true;
303 tools.dav.enable = true;
304 tools.db.enable = true;
305 tools.diaspora.enable = true;
306 tools.etherpad-lite.enable = true;
307 tools.git.enable = true;
308 tools.mastodon.enable = true;
309 tools.mediagoblin.enable = true;
310 tools.peertube.enable = true;
311 tools.performance.enable = true;
312 tools.tools.enable = true;
313 tools.email.enable = true;
315 games.codenames.enable = true;