diff --git a/machines/moritz-server/configuration.nix b/machines/moritz-server/configuration.nix index b4b3136..40b4535 100644 --- a/machines/moritz-server/configuration.nix +++ b/machines/moritz-server/configuration.nix @@ -39,4 +39,44 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDHlemuKagHwz2T5rEwgJNlVUdUdOXyPtCEzD73CrwY2zmpR4AMj7y9u3Rm7HwHUDjLap1ZFwg+53bAsVP6HFZccCXoIfO/8BL0WDGQJrfgb+A+UiRhSqSvyZ77bGJkadbBkadguz3qR3PHcb41DOlhuqVcHxsY8ceHMxAuyb0pLJVJLeytMD+CHS/r7hoj2hckTNAZ+VhCXBtdZfZ7uPUBxLfluYRNNMmdwCglsg3RUS242nJUzy3A84+CXIGeWmNG9Fu45IDkwMthxSW9klyU9R38R9DBDcugkyb6vz+JKSuRVAa47qh/kmtsYekfL3ul9D2JN32P8S+6ZoXx+gXupGJ0ltwJWAFkhLJ+yeXj9kCOv/mIUmCB14jMGsvKiSwV25O/twyjqe2LEkMVgimgrjEYoHu+ZTyp0iFtUvSrFo4tsAhfWPV9yj4F/hUksW7xKIwq5Niyx7he5M/XddudtnAximyiBDGCdJm1Ejl0UaGa6ZQv7y6VZdx0PyZuraT7l9ub8so6JlE4cVgSSU9vE0IS2QqBuHhsIjh8RVksoTR2NQbeDdGaGpGnq2C8y0rDXwE/EJA4LK45khX/GPn73n8F0kBG8dBrWgRDAEODpmebScO7d5mCeM0z3lPcRmh+3e3DPnVVOl+uR7udlc7NauLzl7q913UtxZaF1PlD7Q== cardno:15_584_308 '' ]; + + networking.firewall.allowedTCPPorts = [80 443]; + services.nginx.enable = true; + services.nginx.recommendedProxySettings = true; + services.nginx.virtualHosts = { + "moritzboeh.me" = { + serverAliases = ["*.moritzboeh.me"]; + locations."/" = { + proxyPass = "http://192.168.0.6"; + }; + }; + "moritz.foo" = { + locations."/" = { + return = "200 'Hello World!'"; + }; + }; + }; + services.nginx.streamConfig = '' + upstream diskstation { + server 192.168.0.6:443; + } + + upstream self { + server 127.0.0.1:443; + } + + map $ssl_preread_server_name $name { + *.moritz.foo self; + moritz.foo self; + *.moritzboeh.me diskstation; + moritzboeh.me diskstation; + default diskstation; + } + + server { + listen 443; + ssl_preread on; + proxy_pass $name; + } + ''; }