]>
Commit | Line | Data |
---|---|---|
1 | { lib, pkgs, config, ... }: | |
2 | let | |
3 | cfg = config.myServices.websites.immae.production; | |
4 | varDir = "/var/lib/buildbot/outputs/immaeEu"; | |
5 | coursDir = "/var/lib/buildbot/outputs/cours"; | |
6 | rechercheDir = "/var/lib/buildbot/outputs/recherche"; | |
7 | recettesDir = "/var/lib/buildbot/outputs/recettes"; | |
8 | historyDir = pkgs.callPackage ./history {}; | |
9 | env = config.myEnv.websites.immae; | |
10 | in { | |
11 | options.myServices.websites.immae.production.enable = lib.mkEnableOption "enable Immae's website"; | |
12 | ||
13 | config = lib.mkIf cfg.enable { | |
14 | services.webstats.sites = [ { name = "www.immae.eu"; } ]; | |
15 | ||
16 | services.websites.env.production.vhostConfs.immae_production = { | |
17 | certName = "immae"; | |
18 | addToCerts = true; | |
19 | certMainHost = "www.immae.eu"; | |
20 | hosts = [ "www.immae.eu" "immae.eu" ]; | |
21 | root = varDir; | |
22 | extraConfig = [ | |
23 | '' | |
24 | Use Stats www.immae.eu | |
25 | ||
26 | <LocationMatch /.well-known/(webfinger|host-meta)> | |
27 | Header always set Referrer-Policy "strict-origin-when-cross-origin" | |
28 | Header always set Strict-Transport-Security "max-age=31536000" | |
29 | RequestHeader set X-Forwarded-Proto "https" | |
30 | ||
31 | RewriteRule ^(.*)$ https://mastodon.immae.eu%{REQUEST_URI} [QSA,L] | |
32 | </LocationMatch> | |
33 | ||
34 | RewriteEngine On | |
35 | RewriteCond "%{REQUEST_URI}" "!^/.well-known/(webfinger|host-meta)" | |
36 | RewriteCond "%{HTTP_HOST}" "!^www\.immae\.eu$" [NC] | |
37 | RewriteRule ^(.+)$ https://www.immae.eu$1 [R=302,L] | |
38 | ||
39 | <Directory ${varDir}> | |
40 | DirectoryIndex index.htm index.html | |
41 | Options Indexes FollowSymLinks MultiViews Includes | |
42 | AllowOverride All | |
43 | Require all granted | |
44 | </Directory> | |
45 | ||
46 | Alias /cours ${coursDir} | |
47 | <Directory ${coursDir}> | |
48 | DirectoryIndex index.htm index.html | |
49 | Options Indexes FollowSymLinks MultiViews Includes | |
50 | AllowOverride All | |
51 | Require all granted | |
52 | </Directory> | |
53 | ||
54 | Alias /recherche ${rechercheDir} | |
55 | <Directory ${rechercheDir}> | |
56 | DirectoryIndex index.htm index.html | |
57 | Options Indexes FollowSymLinks MultiViews Includes | |
58 | AllowOverride All | |
59 | Require all granted | |
60 | </Directory> | |
61 | ||
62 | Alias /recettes ${recettesDir} | |
63 | <Directory ${recettesDir}> | |
64 | DirectoryIndex index.htm index.html | |
65 | Options Indexes FollowSymLinks MultiViews Includes | |
66 | AllowOverride All | |
67 | Require all granted | |
68 | </Directory> | |
69 | ||
70 | Alias /history ${historyDir} | |
71 | <Directory ${historyDir}> | |
72 | DirectoryIndex index.html | |
73 | AllowOverride None | |
74 | Require all granted | |
75 | </Directory> | |
76 | '' | |
77 | ]; | |
78 | }; | |
79 | ||
80 | services.websites.env.production.vhostConfs.immae_fr = { | |
81 | certName = "immae"; | |
82 | addToCerts = true; | |
83 | hosts = [ "www.immae.fr" "immae.fr" ]; | |
84 | root = null; | |
85 | extraConfig = [ '' | |
86 | RedirectMatch 301 ^/((?!\.well-known.*$).*)$ https://www.immae.eu/chapeaux/ | |
87 | '' ]; | |
88 | }; | |
89 | ||
90 | services.websites.env.production.vhostConfs.immae_bouya = { | |
91 | certName = "immae"; | |
92 | addToCerts = true; | |
93 | hosts = [ "bouya.org" "www.bouya.org" ]; | |
94 | root = null; | |
95 | extraConfig = [ '' | |
96 | RedirectMatch 301 ^/((?!\.well-known.*$).*)$ https://www.normalesup.org/~bouya/ | |
97 | '' ]; | |
98 | }; | |
99 | }; | |
100 | } |