From a130d322d52452472da93467b6f1ec507d623fa9 Mon Sep 17 00:00:00 2001 From: mups Date: Thu, 28 Nov 2024 16:30:10 +0000 Subject: [PATCH] Add muho to ssh --- hosts/mups/configuration.nix | 2 ++ modules/nixos/server/nginx.nix | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 modules/nixos/server/nginx.nix diff --git a/hosts/mups/configuration.nix b/hosts/mups/configuration.nix index a7f3f81..01984dc 100644 --- a/hosts/mups/configuration.nix +++ b/hosts/mups/configuration.nix @@ -32,6 +32,7 @@ in { mods.server.wireguard.enable = true; mods.server.headscale.enable = false; + mods.server.nginx.enable = true; # Use the GRUB 2 boot loader. boot.loader.grub.enable = true; @@ -42,6 +43,7 @@ in { openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKEio+Y5wBVD1wILaH2R3wV10FvVjiqy/4gGBWHOITTB muon@muon" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKevYmkH7xvYoquBjnYZ7PJiVqf+GOh9fxAJBN6wZGBB gin4@hi.is" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILmAOd9VbhyJeibt6Vrb101MNTk5W8+rh94Djv/C+pyu muon@muho" ]; }; diff --git a/modules/nixos/server/nginx.nix b/modules/nixos/server/nginx.nix new file mode 100644 index 0000000..831a27e --- /dev/null +++ b/modules/nixos/server/nginx.nix @@ -0,0 +1,21 @@ +{ pkgs, lib, config, ... }: { + options.mods.server.nginx = { + enable = lib.mkEnableOption { + default = false; + description = "enables nginx reverse proxy"; + }; + }; + + config = lib.mkIf config.mods.server.nginx.enable { + services.nginx = { + recommendedProxySettings = true; + virtualHosts."*.muon.host" = { + locations."/" = { + proxyPass = "http://100.112.114.27:443"; + proxyWebsockets = true; # needed if you need to use WebSocket + extraConfig = "proxy_ssl_server_name on;"; + }; + }; + }; + }; +}