hackens-org-configurations/machines/org/static-sites.nix

63 lines
1.3 KiB
Nix
Raw Normal View History

2023-12-04 17:42:06 +01:00
{ pkgs, lib, ... }:
let
sites = [
"/NdS"
"/2048"
"/prez"
"/known"
"/pub"
];
in
{
services.nginx.enable = true;
services.nginx.virtualHosts = {
"new.hackens.org" = {
forceSSL = true;
enableACME = true;
locations = lib.genAttrs sites (name: {
root = "/var/www";
extraConfig = "autoindex on;";
});
};
# Legacy redirections
#"known.hackens.org" = {
# forceSSL = true;
# enableACME = true;
# extraConfig = ''
# return 301 $scheme://hackens.org/known$request_uri;
# '';
#};
#"nds.hackens.org" = {
# forceSSL = true;
# enableACME = true;
# extraConfig = ''
# return 301 $scheme://hackens.org/known$request_uri;
# '';
#};
#"prez.hackens.org" = {
# forceSSL = true;
# enableACME = true;
# extraConfig = ''
# return 301 $scheme://hackens.org/prez$request_uri;
# '';
#};
#"pub.hackens.org" = {
# forceSSL = true;
# enableACME = true;
# extraConfig = ''
# return 301 $scheme://hackens.org/pub$request_uri;
# '';
#};
#"2048.hackens.org" = {
# forceSSL = true;
# enableACME = true;
# extraConfig = ''
# return 301 $scheme://hackens.org/2048$request_uri;
# '';
#};
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
}