Prepare to replace knakelibrak

Co-authored-by: Felix Albrigtsen <felix@albrigtsen.it>
This commit is contained in:
Oystein Kristoffer Tveit 2023-11-05 01:41:45 +01:00
parent 54a54ad0f5
commit d5985e02f3
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
3 changed files with 53 additions and 1 deletions

View File

@ -10,7 +10,7 @@
# TODO: set up authentication for the following:
# ./services/website.nix
./services/nginx.nix
./services/nginx
./services/gitea/default.nix
./services/webmail
# ./services/mediawiki.nix

View File

@ -1,5 +1,9 @@
{ pkgs, config, ... }:
{
imports = [
./ingress.nix
];
security.acme = {
acceptTerms = true;
defaults.email = "drift@pvv.ntnu.no";

View File

@ -0,0 +1,48 @@
{ config, lib, ... }:
{
services.nginx.virtualHosts = {
"www2.pvv.ntnu.no" = {
addSSL = true;
enableACME = true;
# TODO after updating the corresponding DNS record:
# serverAliases = [ "www2.pvv.org" "pvv.ntnu.no" "pvv.org" ]
serverAliases = [ "www2.pvv.org" ];
locations = {
# Redirect the main website
"= /".return = "301 https://www.pvv.ntnu.no/";
# 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";
# TODO: Redirect web main
"/webmail".return = "301 https://webmail.pvv.ntnu.no/squirrelmail";
};
};
};
}