]> Git — Sourcephile - sourcephile-nix.git/blob - machines/mermet/nginx/sourcephile.fr/www.nix
nix: update to latest nixpkgs
[sourcephile-nix.git] / machines / mermet / nginx / sourcephile.fr / www.nix
1 { domain, ... }:
2 { pkgs, lib, config, ... }:
3 let inherit (config) networking;
4 inherit (config.services) nginx;
5 srv = "www";
6 in
7 {
8 systemd.services.nginx.serviceConfig = {
9 BindPaths = [ "/home/julm/work/sourcephile/txt:/www" ];
10 };
11 services.nginx = {
12 virtualHosts."${srv}" = {
13 serverName = "${srv}.${domain}";
14 serverAliases = [ domain ];
15 forceSSL = true;
16 useACMEHost = domain;
17 root = "/www";
18 extraConfig = ''
19 access_log /var/log/nginx/${domain}/${srv}/access.log json buffer=32k;
20 error_log /var/log/nginx/${domain}/${srv}/error.log warn;
21 '';
22 locations."/".extraConfig = ''
23 #autoindex on;
24 fancyindex on;
25 fancyindex_name_length 255;
26 fancyindex_exact_size off;
27 '';
28 locations."/git".return = "302 https://git.${domain}/$request_uri";
29 locations."/versions".return = "302 https://git.${domain}/$request_uri";
30 locations."/codes_sources".return = "302 http://git.${domain}";
31 locations."/mails".return = "302 https://mails.${domain}/$request_uri";
32 locations."/listes".return = "302 https://mails.${domain}/$request_uri";
33 };
34 };
35 systemd.services.nginx.serviceConfig.LogsDirectory = lib.mkForce ["nginx/${domain}/${srv}"];
36 }