summaryrefslogtreecommitdiff
path: root/os/srv/nginx.nix
diff options
context:
space:
mode:
authoradikro <adikro@disroot.org>2026-05-10 23:02:01 +0200
committeradikro <adikro@disroot.org>2026-05-10 23:02:01 +0200
commit7c8503e8fa77cb20819e2ba5a6a0f1a261cf089f (patch)
tree212001f743fba7224ac57007e1a499c7615c0b19 /os/srv/nginx.nix
parentbaf1cf5664b481de17849c97dc683fa81ade1c2e (diff)
added basic configuration for nginx, oci-containers and simplex-chat servers
Diffstat (limited to 'os/srv/nginx.nix')
-rw-r--r--os/srv/nginx.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/os/srv/nginx.nix b/os/srv/nginx.nix
new file mode 100644
index 0000000..b0c01a7
--- /dev/null
+++ b/os/srv/nginx.nix
@@ -0,0 +1,36 @@
+{ config, lib, ... }:
+
+let
+ cfg = config.os.srv.nginx;
+in
+{
+ options.os.srv.nginx = {
+ enable = lib.mkEnableOption "the NGINX reverse proxy service";
+
+ openFirewall = lib.mkOption {
+ type = lib.types.bool;
+ default = true;
+ description = "Whether to open ports 80 and 443 in the firewall.";
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ services.nginx = {
+ enable = true;
+
+ recommendedProxySettings = true;
+ recommendedTlsSettings = true;
+ recommendedOptimisation = true;
+ recommendedGzipSettings = true;
+ };
+
+ networking.firewall.allowedTCPPorts = lib.mkOptional cfg.openFirewall [
+ 80
+ 443
+ ];
+
+ systemd.tmpfiles.rules = [
+ "d /var/log/nginx 0750 nginx adm -"
+ ];
+ };
+}