refactor: streamline all websites into one folder

This commit is contained in:
Rouven Seifert 2024-03-12 11:49:01 +01:00
parent 71fdea75be
commit b429e6468f
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09
12 changed files with 17 additions and 11 deletions

39
modules/web/ftp.nix Normal file
View file

@ -0,0 +1,39 @@
{ config, pkgs, ... }:
let
domain = "ftp.${config.networking.domain}";
in
{
services.nginx.additionalModules = [ pkgs.nginxModules.fancyindex ];
services.nginx.virtualHosts."${domain}" = {
enableACME = true;
forceSSL = true;
root = "/srv/ftp";
extraConfig = ''
fancyindex on;
fancyindex_exact_size off;
error_page 403 /403.html;
'';
locations."~/(klausuren|uebungen|skripte|abschlussarbeiten)".extraConfig = ''
allow 141.30.0.0/16;
allow 141.76.0.0/16;
deny all;
'';
locations."~ /komplexpruef".extraConfig = ''
default_type text/plain;
'';
locations."=/403.html" = {
root = pkgs.writeTextDir "403.html" ''
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<center><h1>403 Forbidden</h1></center>
<center>Dieser Ordner ist nur aus dem Uni-Netz zug&aumlnglich.</center>
<center>This directory is only accessible from the TUD network.</center>
</body>
</html>
'';
};
};
}