From 3651ddb6cbdfcd965bb72756f67ca3fb2952a3c0 Mon Sep 17 00:00:00 2001 From: Zhongheng Liu Date: Fri, 9 Aug 2024 16:15:27 +0800 Subject: [PATCH] feat: new nginx configuration --- nixos/services/nginx.service.nix | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/nixos/services/nginx.service.nix b/nixos/services/nginx.service.nix index ae374c7..798f078 100644 --- a/nixos/services/nginx.service.nix +++ b/nixos/services/nginx.service.nix @@ -1,6 +1,21 @@ -{...}: -{ - services.nginx = { - enable = true; - }; +{pkgs, ...}: { + services.nginx = { + enable = true; + virtualHosts."localhost" = { + root = "/srv/public"; + locations = { + "/" = { + root = "/srv/public"; + extraConfig = '' + autoindex on; + ''; + }; + }; + listenAddresses = [ + "127.0.0.1" + "[::1]" + ]; + }; + }; + networking.firewall.allowedTCPPorts = [80]; }