From 7dec183043e932e33c1c3953efa2ea0780aea12e Mon Sep 17 00:00:00 2001 From: Noah Pederson Date: Wed, 5 Mar 2025 21:40:44 -0600 Subject: [PATCH] ADD: nginx static file hosting on img.ngp.computer --- packages.nix | 1 + services.nix | 37 +++++++++++++++++++++++++++++-------- users.nix | 2 +- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/packages.nix b/packages.nix index 7aaa8d2..abe873a 100644 --- a/packages.nix +++ b/packages.nix @@ -106,5 +106,6 @@ in "obsidian" "tailscale" "plexmediaserver" + "sftpgo" ]; } diff --git a/services.nix b/services.nix index 7379625..825aa99 100644 --- a/services.nix +++ b/services.nix @@ -18,7 +18,7 @@ in # programs.mtr.enable = true; programs.gnupg.agent = { enable = true; - enableSSHSupport = true; + enableSSHSupport = false; }; # Fish shell, the best @@ -202,7 +202,12 @@ in }; }; - services.webdav.enable = true; + services.webdav.enable = false; + services.sftpgo = { + enable = false; + dataDir = /srv/shokuhou/documents/sftpgo; + group = "nas"; + }; services.grafana = { enable = false; @@ -330,7 +335,8 @@ in # Nginx Reverse SSL Proxy services.nginx = { enable = true; - group = "httpd"; + group = "nas"; + user = "noah"; # This is disabled for now #virtualHosts."${config.services.grafana.settings.server.domain}" = { @@ -343,15 +349,30 @@ in virtualHosts."img.ngp.computer" = { forceSSL = true; enableACME = true; - # Don't use this unless you want the contents of this folder to be in the Nix - # Store and only updated when switching - #root = "/srv/shokuhou/pictures/public"; + root = "/srv/shokuhou/pictures/public"; extraConfig = '' sendfile on; - sendfile_max_chunk 1m; + autoindex_exact_size on; tcp_nopush on; - root /srv/shokuhou/pictures/public; ''; + locations."/" = { + extraConfig = '' + autoindex on; + autoindex_exact_size on; + alias /srv/shokuhou/pictures/public/$1; + ''; + }; + # Don't use this unless you want the contents of this folder to be in the Nix + # Store and only updated when switching + #root = "/srv/shokuhou/pictures/public"; + #extraConfig = '' + # sendfile on; + # sendfile_max_chunk 1m; + # tcp_nopush on; + # root /srv/shokuhou/pictures/public; + # location ~ /.* { + # } + #''; }; # give a name to the virtual host. It also becomes the server name. diff --git a/users.nix b/users.nix index 633b68f..8ca291c 100644 --- a/users.nix +++ b/users.nix @@ -19,7 +19,7 @@ in users.users.noah = { isNormalUser = true; shell = pkgs.fish; - extraGroups = [ "wheel" "video" "nas" "nats" "litterbox" ]; # Enable ‘sudo’ for the user. + extraGroups = [ "wheel" "video" "nas" "nats" "litterbox" "httpd" ]; # Enable ‘sudo’ for the user. hashedPasswordFile = "/etc/nixos/noah-password"; openssh.authorizedKeys.keys = lib.strings.splitString "\n" (builtins.readFile (builtins.fetchurl { -- 2.51.2