fruitbasket/modules/web/ftp.nix

39 lines
1 KiB
Nix
Raw Normal View History

2023-03-24 17:05:30 +01:00
{ config, pkgs, ... }:
let
domain = "ftp.${config.networking.domain}";
2023-03-24 17:05:30 +01:00
in
{
2023-08-22 14:35:26 +02:00
services.nginx.additionalModules = [ pkgs.nginxModules.fancyindex ];
2023-03-24 17:05:30 +01:00
services.nginx.virtualHosts."${domain}" = {
root = "/srv/ftp";
extraConfig = ''
2023-08-22 14:32:23 +02:00
fancyindex on;
fancyindex_exact_size off;
2024-02-27 14:06:06 +01:00
error_page 403 /403.html;
2024-03-16 22:41:36 +01:00
fancyindex_localtime on;
2023-03-24 17:05:30 +01:00
'';
locations."~/(klausuren|uebungen|skripte|abschlussarbeiten)".extraConfig = ''
2023-03-24 17:06:40 +01:00
allow 141.30.0.0/16;
allow 141.76.0.0/16;
deny all;
2023-03-24 17:05:30 +01:00
'';
locations."~ /komplexpruef".extraConfig = ''
default_type text/plain;
'';
2024-02-27 14:06:06 +01:00
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>
'';
};
2023-03-24 17:05:30 +01:00
};
}