nix-infra/config/hosts/public-web-static/virtualHosts/historic-easterhegg/eh05.nix

101 lines
2.6 KiB
Nix

{ pkgs, ... }:
let
eh05 = pkgs.fetchgit {
url = "https://git.hamburg.ccc.de/CCCHH/easterhegg-2005-website.git";
rev = "f1455aee35b6462ab5c46f3d52c47e0b200c1315";
hash = "sha256-lA4fxO05K39nosSYNfKUtSCrK+dja1yWKILqRklSNy8=";
};
in
{
security.acme.certs."eh05.easterhegg.eu".extraDomainNames = [
"eh2005.hamburg.ccc.de"
"www.eh2005.hamburg.ccc.de"
"easterhegg2005.hamburg.ccc.de"
"www.easterhegg2005.hamburg.ccc.de"
];
services.nginx.virtualHosts = {
"acme-eh05.easterhegg.eu" = {
enableACME = true;
serverName = "eh05.easterhegg.eu";
serverAliases = [
"eh2005.hamburg.ccc.de"
"www.eh2005.hamburg.ccc.de"
"easterhegg2005.hamburg.ccc.de"
"www.easterhegg2005.hamburg.ccc.de"
];
listen = [{
addr = "0.0.0.0";
port = 31820;
}];
};
"easterhegg2005.hamburg.ccc.de" = {
forceSSL = true;
useACMEHost = "eh05.easterhegg.eu";
serverAliases = [
"eh2005.hamburg.ccc.de"
"www.eh2005.hamburg.ccc.de"
"www.easterhegg2005.hamburg.ccc.de"
];
listen = [{
addr = "0.0.0.0";
port = 8443;
ssl = true;
proxyProtocol = true;
}];
locations."/".return = "302 https://eh05.easterhegg.eu";
extraConfig = ''
# Make use of the ngx_http_realip_module to set the $remote_addr and
# $remote_port to the client address and client port, when using proxy
# protocol.
# First set our proxy protocol proxy as trusted.
set_real_ip_from 172.31.17.140;
# Then tell the realip_module to get the addreses from the proxy protocol
# header.
real_ip_header proxy_protocol;
'';
};
"eh05.easterhegg.eu" = {
forceSSL = true;
useACMEHost = "eh05.easterhegg.eu";
listen = [{
addr = "0.0.0.0";
port = 8443;
ssl = true;
proxyProtocol = true;
}];
locations."/" = {
index = "index.shtml";
root = eh05;
extraConfig = ''
# Set default_type to html
default_type text/html;
# Enable SSI
ssi on;
'';
};
extraConfig = ''
# Make use of the ngx_http_realip_module to set the $remote_addr and
# $remote_port to the client address and client port, when using proxy
# protocol.
# First set our proxy protocol proxy as trusted.
set_real_ip_from 172.31.17.140;
# Then tell the realip_module to get the addreses from the proxy protocol
# header.
real_ip_header proxy_protocol;
# Enable SSI
ssi on;
'';
};
};
}