From b7cd7e4b3eae30b588c6e3a75e5a658f09ca8269 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 4 Jan 2019 18:43:02 +0100 Subject: [PATCH] Add some apache configuration Add vhost to log format Add http2 --- virtual/eldiron.nix | 55 +++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/virtual/eldiron.nix b/virtual/eldiron.nix index 51e2bb9..d88dd93 100644 --- a/virtual/eldiron.nix +++ b/virtual/eldiron.nix @@ -12,8 +12,6 @@ }; in { - # FIXME: they are not overriden in packages.nix - # (see nix-store -q --tree /nix/var/nix/profiles/system) nixpkgs.config.packageOverrides = oldpkgs: rec { gitolite = nixpkgs_unstable.gitolite; gitweb = oldpkgs.gitweb.overrideAttrs(old: { @@ -234,11 +232,13 @@ }; services.httpd = let - withSSL = domain: { + withConf = domain: { enableSSL = true; sslServerCert = "/var/lib/acme/${domain}/cert.pem"; sslServerKey = "/var/lib/acme/${domain}/key.pem"; sslServerChain = "/var/lib/acme/${domain}/fullchain.pem"; + logFormat = "combinedVhost"; + listen = [ { ip = "*"; port = 443; } ]; }; apacheConfig = { gzip = { @@ -270,29 +270,25 @@ ''; }; + http2 = { + modules = [ "http2" ]; + extraConfig = '' + Protocols h2 http/1.1 + ''; + }; + customLog = { + modules = []; + extraConfig = '' + LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %p" combinedVhost + ''; + }; }; in rec { enable = true; logPerVirtualHost = true; multiProcessingModule = "worker"; adminAddr = "httpd@immae.eu"; - # FIXME: http2 - # FIXME: voir les autres modules: - # authz_core_module - # reqtimeout_module - # http2_module - # version_module - # proxy_connect_module - # proxy_ftp_module - # proxy_scgi_module - # proxy_ajp_module - # proxy_balancer_module - # proxy_express_module - # lbmethod_byrequests_module - # lbmethod_bytraffic_module - # lbmethod_bybusyness_module - # lbmethod_heartbeat_module - + logFormat = "combinedVhost"; extraModules = pkgs.lib.lists.unique ( mypkgs.adminer.apache.modules ++ mypkgs.nextcloud.apache.modules ++ @@ -306,24 +302,21 @@ extraConfig = builtins.concatStringsSep "\n" (pkgs.lib.attrsets.mapAttrsToList (n: v: v.extraConfig) apacheConfig); virtualHosts = [ - (withSSL "eldiron" // { - listen = [ { ip = "*"; port = 443; } ]; + (withConf "eldiron" // { hostName = "eldiron.immae.eu"; documentRoot = ./www; extraConfig = '' DirectoryIndex index.htm ''; }) - (withSSL "eldiron" // { - listen = [ { ip = "*"; port = 443; } ]; + (withConf "eldiron" // { hostName = "db-1.immae.eu"; documentRoot = null; extraConfig = builtins.concatStringsSep "\n" [ mypkgs.adminer.apache.vhostConf ]; }) - (withSSL "eldiron" // { - listen = [ { ip = "*"; port = 443; } ]; + (withConf "eldiron" // { hostName = "tools.immae.eu"; documentRoot = null; extraConfig = builtins.concatStringsSep "\n" [ @@ -331,8 +324,7 @@ mypkgs.ympd.apache.vhostConf ]; }) - (withSSL "eldiron" // { - listen = [ { ip = "*"; port = 443; } ]; + (withConf "eldiron" // { hostName = "connexionswing.immae.eu"; serverAliases = [ "sandetludo.immae.eu" ]; documentRoot = mypkgs.connexionswing_dev.webRoot; @@ -340,16 +332,14 @@ mypkgs.connexionswing_dev.apache.vhostConf ]; }) - (withSSL "eldiron" // { - listen = [ { ip = "*"; port = 443; } ]; + (withConf "eldiron" // { hostName = "cloud.immae.eu"; documentRoot = mypkgs.nextcloud.webRoot; extraConfig = builtins.concatStringsSep "\n" [ mypkgs.nextcloud.apache.vhostConf ]; }) - (withSSL "eldiron" // { - listen = [ { ip = "*"; port = 443; } ]; + (withConf "eldiron" // { hostName = "git.immae.eu"; documentRoot = mypkgs.git.web.webRoot; extraConfig = builtins.concatStringsSep "\n" [ @@ -366,6 +356,7 @@ hostName = "redirectSSL"; serverAliases = [ "*" ]; enableSSL = false; + logFormat = "combinedVhost"; documentRoot = "/var/lib/acme/acme-challenge"; extraConfig = '' RewriteEngine on -- 2.41.0