mermet: nginx: add www virtualHost
authorJulien Moutinho <julm@autogeree.net>
Fri, 24 Jan 2020 14:52:13 +0000 (14:52 +0000)
committerJulien Moutinho <julm@autogeree.net>
Fri, 24 Jan 2020 14:52:13 +0000 (14:52 +0000)
servers/mermet/nginx.nix
servers/mermet/nginx/gitweb.nix
servers/mermet/nginx/www.nix [new file with mode: 0644]

index a376c540e44eacb93ef77783dda5c6eff762e1e5..8b9ef1db8a06273217c941d6ebfc65ad2f944063 100644 (file)
@@ -10,6 +10,7 @@ in
 {
 imports = [
   nginx/gitweb.nix
+  nginx/www.nix
 ];
 options = {
   services.nginx = {
@@ -190,10 +191,10 @@ config = {
         '';
       });
     appendConfig = ''
-      worker_processes 2;
+      worker_processes 4;
     '';
     virtualHosts."_" = {
-      forceSSL = true;
+      forceSSL = false;
       # Convoluted way to load the certificate in the store and using ${networking.domainBase} to find it.
       # NOTE: no ssl_stapling while the certificate remains self-signed.
       sslCertificate = loadFile (../../../sec + "/openssl/${networking.domainBase}/cert.self-signed.pem");
index 7dc74e10ad128e897126ca036a333dfd0b2637c6..e258031f5652da4ee0371231a729e4e523414cd0 100644 (file)
@@ -1,4 +1,4 @@
-{pkgs, lib, config, ...}:
+{ pkgs, lib, config, ... }:
 let inherit (config) networking;
     inherit (config.services) gitweb gitolite nginx;
     package = pkgs.gitweb.override (lib.optionalAttrs gitweb.gitwebTheme {
diff --git a/servers/mermet/nginx/www.nix b/servers/mermet/nginx/www.nix
new file mode 100644 (file)
index 0000000..5c2ad3f
--- /dev/null
@@ -0,0 +1,21 @@
+{ pkgs, lib, config, ... }:
+let inherit (config) networking;
+    inherit (config.services) nginx;
+in
+{
+  services.nginx = {
+    virtualHosts."www" = {
+      serverName = "www.${networking.domain}";
+      serverAliases =
+        [ networking.domain ]
+        ++ config.networking.domainAliases
+        ++ map (domainAlias: "www." + domainAlias)
+          config.networking.domainAliases;
+      forceSSL = false;
+      enableSSL = false;
+      #sslCertificate = nginx.virtualHosts."_".sslCertificate;
+      #sslCertificateKey = nginx.virtualHosts."_".sslCertificateKey;
+      globalRedirect = "git.${networking.domain}";
+    };
+  };
+}