forked from Drift/pvv-nixos-config
Merge pull request 'replace-knakelibrak-nginx-reverse-proxy' (#18) from replace-knakelibrak-nginx-reverse-proxy into main
Reviewed-on: Drift/pvv-nixos-config#18
This commit is contained in:
commit
d8031ecca1
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
# TODO: set up authentication for the following:
|
# TODO: set up authentication for the following:
|
||||||
# ./services/website.nix
|
# ./services/website.nix
|
||||||
./services/nginx.nix
|
./services/nginx
|
||||||
./services/gitea/default.nix
|
./services/gitea/default.nix
|
||||||
./services/webmail
|
./services/webmail
|
||||||
# ./services/mediawiki.nix
|
# ./services/mediawiki.nix
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
{ pkgs, config, ... }:
|
{ pkgs, config, ... }:
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
./ingress.nix
|
||||||
|
];
|
||||||
|
|
||||||
security.acme = {
|
security.acme = {
|
||||||
acceptTerms = true;
|
acceptTerms = true;
|
||||||
defaults.email = "drift@pvv.ntnu.no";
|
defaults.email = "drift@pvv.ntnu.no";
|
|
@ -0,0 +1,55 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
{
|
||||||
|
services.nginx.virtualHosts = {
|
||||||
|
"www2.pvv.ntnu.no" = {
|
||||||
|
serverAliases = [ "www2.pvv.org" "pvv.ntnu.no" "pvv.org" ];
|
||||||
|
addSSL = true;
|
||||||
|
enableACME = true;
|
||||||
|
|
||||||
|
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";
|
||||||
|
|
||||||
|
# TODO: Redirect webmail
|
||||||
|
"/webmail".return = "301 https://webmail.pvv.ntnu.no/squirrelmail";
|
||||||
|
|
||||||
|
# Redirect everything else to the main website
|
||||||
|
"/".return = "301 https://www.pvv.ntnu.no$request_uri";
|
||||||
|
|
||||||
|
# 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/;
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue