2023-11-05 01:41:45 +01:00
|
|
|
{ config, lib, ... }:
|
|
|
|
{
|
|
|
|
services.nginx.virtualHosts = {
|
2024-03-28 10:52:59 +01:00
|
|
|
"pvv.ntnu.no" = {
|
|
|
|
serverAliases = [ "pvv.org" ];
|
2023-11-05 01:41:45 +01:00
|
|
|
addSSL = true;
|
|
|
|
enableACME = true;
|
2024-04-10 22:01:19 +02:00
|
|
|
kTLS = true;
|
2023-11-05 01:41:45 +01:00
|
|
|
|
|
|
|
locations = {
|
|
|
|
# Proxy home directories
|
|
|
|
"/~" = {
|
|
|
|
extraConfig = ''
|
|
|
|
proxy_redirect off;
|
|
|
|
proxy_pass https://tom.pvv.ntnu.no;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
# Redirect old wiki entries
|
|
|
|
"/disk".return = "301 https://www.pvv.ntnu.no/pvv/Diskkjøp";
|
|
|
|
"/dok/boker.php".return = "301 https://www.pvv.ntnu.no/pvv/Bokhyllen";
|
|
|
|
"/styret/lover/".return = "301 https://www.pvv.ntnu.no/pvv/Lover";
|
|
|
|
"/styret/".return = "301 https://www.pvv.ntnu.no/pvv/Styret";
|
|
|
|
"/info/".return = "301 https://www.pvv.ntnu.no/pvv/";
|
|
|
|
"/info/maskinpark/".return = "301 https://www.pvv.ntnu.no/pvv/Maskiner";
|
|
|
|
"/medlemssider/meldinn.php".return = "301 https://www.pvv.ntnu.no/pvv/Medlemskontingent";
|
|
|
|
"/diverse/medlems-sider.php".return = "301 https://www.pvv.ntnu.no/pvv/Medlemssider";
|
|
|
|
"/cert/".return = "301 https://www.pvv.ntnu.no/pvv/CERT";
|
|
|
|
"/drift".return = "301 https://www.pvv.ntnu.no/pvv/Drift";
|
|
|
|
"/diverse/abuse.php".return = "301 https://www.pvv.ntnu.no/pvv/CERT/Abuse";
|
|
|
|
"/nerds/".return = "301 https://www.pvv.ntnu.no/pvv/Nerdepizza";
|
|
|
|
|
2023-11-27 20:31:19 +01:00
|
|
|
# TODO: Redirect webmail
|
2023-11-05 01:41:45 +01:00
|
|
|
"/webmail".return = "301 https://webmail.pvv.ntnu.no/squirrelmail";
|
2023-11-27 20:31:19 +01:00
|
|
|
|
|
|
|
# Redirect everything else to the main website
|
|
|
|
"/".return = "301 https://www.pvv.ntnu.no$request_uri";
|
2023-11-28 05:43:23 +01:00
|
|
|
|
|
|
|
# Proxy the matrix well-known files
|
|
|
|
# Host has be set before proxy_pass
|
|
|
|
# The header must be set so nginx on the other side routes it to the right place
|
|
|
|
"/.well-known/matrix/" = {
|
|
|
|
extraConfig = ''
|
|
|
|
proxy_set_header Host matrix.pvv.ntnu.no;
|
|
|
|
proxy_pass https://matrix.pvv.ntnu.no/.well-known/matrix/;
|
|
|
|
'';
|
|
|
|
};
|
2023-11-05 01:41:45 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|