forked from CCCHH/nix-infra
107 lines
2.8 KiB
Nix
107 lines
2.8 KiB
Nix
|
{ pkgs, ... }:
|
||
|
|
||
|
let
|
||
|
eh11 = pkgs.fetchgit {
|
||
|
url = "https://git.hamburg.ccc.de/CCCHH/easterhegg-2011-website.git";
|
||
|
rev = "c20540af71d4a0bd1fa12f49962b92d04293415b";
|
||
|
hash = "sha256-9hhtfU8fp2HOThcyQ4R7kuGQBjZktqMtiiYQhOas2QA=";
|
||
|
};
|
||
|
in
|
||
|
{
|
||
|
security.acme.certs."eh11.easterhegg.eu".extraDomainNames = [
|
||
|
"eh2011.hamburg.ccc.de"
|
||
|
"www.eh2011.hamburg.ccc.de"
|
||
|
"eh11.hamburg.ccc.de"
|
||
|
"www.eh11.hamburg.ccc.de"
|
||
|
"easterhegg2011.hamburg.ccc.de"
|
||
|
"www.easterhegg2011.hamburg.ccc.de"
|
||
|
];
|
||
|
|
||
|
services.nginx.virtualHosts = {
|
||
|
"acme-eh11.easterhegg.eu" = {
|
||
|
enableACME = true;
|
||
|
serverName = "eh11.easterhegg.eu";
|
||
|
serverAliases = [
|
||
|
"eh2011.hamburg.ccc.de"
|
||
|
"www.eh2011.hamburg.ccc.de"
|
||
|
"eh11.hamburg.ccc.de"
|
||
|
"www.eh11.hamburg.ccc.de"
|
||
|
"easterhegg2011.hamburg.ccc.de"
|
||
|
"www.easterhegg2011.hamburg.ccc.de"
|
||
|
];
|
||
|
listen = [{
|
||
|
addr = "0.0.0.0";
|
||
|
port = 31820;
|
||
|
}];
|
||
|
};
|
||
|
|
||
|
"easterhegg2011.hamburg.ccc.de" = {
|
||
|
forceSSL = true;
|
||
|
useACMEHost = "eh11.easterhegg.eu";
|
||
|
serverAliases = [
|
||
|
"eh2011.hamburg.ccc.de"
|
||
|
"www.eh2011.hamburg.ccc.de"
|
||
|
"eh11.hamburg.ccc.de"
|
||
|
"www.eh11.hamburg.ccc.de"
|
||
|
"www.easterhegg2011.hamburg.ccc.de"
|
||
|
];
|
||
|
|
||
|
listen = [{
|
||
|
addr = "0.0.0.0";
|
||
|
port = 8443;
|
||
|
ssl = true;
|
||
|
proxyProtocol = true;
|
||
|
}];
|
||
|
|
||
|
locations."/".return = "302 https://eh11.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;
|
||
|
'';
|
||
|
};
|
||
|
|
||
|
"eh11.easterhegg.eu" = {
|
||
|
forceSSL = true;
|
||
|
useACMEHost = "eh11.easterhegg.eu";
|
||
|
|
||
|
listen = [{
|
||
|
addr = "0.0.0.0";
|
||
|
port = 8443;
|
||
|
ssl = true;
|
||
|
proxyProtocol = true;
|
||
|
}];
|
||
|
|
||
|
locations."/" = {
|
||
|
index = "index.shtml";
|
||
|
root = eh11;
|
||
|
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;
|
||
|
'';
|
||
|
};
|
||
|
};
|
||
|
}
|