]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/immae/production.nix
Use local website for research
[perso/Immae/Config/Nix.git] / modules / private / websites / immae / production.nix
CommitLineData
ab8f306d 1{ lib, pkgs, config, ... }:
f759f52e 2let
f8026b6e 3 cfg = config.myServices.websites.immae.production;
cb589b2e
IB
4 varDir = "/var/lib/buildbot/outputs/immae/blog";
5 coursDir = "/var/lib/buildbot/outputs/immae/cours";
6 rechercheDir = "/var/lib/buildbot/outputs/immae/recherche";
7 recettesDir = "/var/lib/buildbot/outputs/immae/recettes";
577d00ee 8 historyDir = "/var/lib/buildbot/outputs/immae/history";
ab8f306d 9 env = config.myEnv.websites.immae;
f759f52e 10in {
f8026b6e 11 options.myServices.websites.immae.production.enable = lib.mkEnableOption "enable Immae's website";
f759f52e 12
f8026b6e 13 config = lib.mkIf cfg.enable {
9eae2b47 14 services.webstats.sites = [ { name = "www.immae.eu"; } ];
f759f52e 15
d3452fc5
IB
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 = [
f759f52e
IB
23 ''
24 Use Stats www.immae.eu
46c99b57 25 Header always set Strict-Transport-Security "max-age=31536000"
f759f52e 26
6da0830e
IB
27 <LocationMatch /.well-known/(webfinger|host-meta)>
28 Header always set Referrer-Policy "strict-origin-when-cross-origin"
6da0830e
IB
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
f759f52e 39 <Directory ${varDir}>
0012da0f
IB
40 DirectoryIndex index.htm index.html
41 Options Indexes FollowSymLinks MultiViews Includes
42 AllowOverride All
43 Require all granted
44 </Directory>
45
196c6e3c
IB
46 Alias /.well-known/chatonsinfos ${./chatons}
47 <Directory ${./chatons}>
48 Options Indexes FollowSymLinks MultiViews Includes
49 AllowOverride None
50 Require all granted
51 </Directory>
52
0012da0f
IB
53 Alias /cours ${coursDir}
54 <Directory ${coursDir}>
55 DirectoryIndex index.htm index.html
56 Options Indexes FollowSymLinks MultiViews Includes
57 AllowOverride All
58 Require all granted
59 </Directory>
60
23f9fdf0
IB
61 Alias /eurl ${./eurl}
62 <Directory ${./eurl}>
63 DirectoryIndex index.htm index.html
64 Options Indexes FollowSymLinks MultiViews Includes
65 AllowOverride None
66 Require all granted
67 </Directory>
68
0012da0f
IB
69 Alias /recherche ${rechercheDir}
70 <Directory ${rechercheDir}>
71 DirectoryIndex index.htm index.html
f759f52e
IB
72 Options Indexes FollowSymLinks MultiViews Includes
73 AllowOverride All
74 Require all granted
75 </Directory>
f2a18fd6
IB
76
77 Alias /recettes ${recettesDir}
78 <Directory ${recettesDir}>
79 DirectoryIndex index.htm index.html
80 Options Indexes FollowSymLinks MultiViews Includes
81 AllowOverride All
82 Require all granted
83 </Directory>
7130402c
IB
84
85 Alias /history ${historyDir}
86 <Directory ${historyDir}>
87 DirectoryIndex index.html
88 AllowOverride None
89 Require all granted
90 </Directory>
f759f52e
IB
91 ''
92 ];
93 };
70606070 94
d3452fc5
IB
95 services.websites.env.production.vhostConfs.immae_fr = {
96 certName = "immae";
8cf37c75
IB
97 addToCerts = true;
98 hosts = [ "www.immae.fr" "immae.fr" ];
99 root = null;
100 extraConfig = [ ''
101 RedirectMatch 301 ^/((?!\.well-known.*$).*)$ https://www.immae.eu/chapeaux/
102 '' ];
103 };
104
d3452fc5
IB
105 services.websites.env.production.vhostConfs.immae_bouya = {
106 certName = "immae";
7df420c2 107 addToCerts = true;
70606070 108 hosts = [ "bouya.org" "www.bouya.org" ];
c5f1602f 109 root = rechercheDir;
70606070 110 extraConfig = [ ''
c5f1602f
IB
111 <Directory ${rechercheDir}>
112 DirectoryIndex index.htm index.html
113 Options Indexes FollowSymLinks MultiViews Includes
114 AllowOverride All
115 Require all granted
116 </Directory>
70606070
IB
117 '' ];
118 };
f759f52e
IB
119 };
120}