]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - nixops/modules/websites/ftp/immae.nix
Start moving websites configuration to modules
[perso/Immae/Config/Nix.git] / nixops / modules / websites / ftp / immae.nix
1 { lib, pkgs, config, myconfig, ... }:
2 let
3 cfg = config.services.myWebsites.Immae;
4 varDir = "/var/lib/ftp/immae";
5 env = myconfig.env.websites.immae;
6 in {
7 options.services.myWebsites.Immae = {
8 production = {
9 enable = lib.mkEnableOption "enable Immae's website";
10 };
11 };
12
13 config = lib.mkIf cfg.production.enable {
14 services.webstats.sites = [ { name = "www.immae.eu"; } ];
15
16 security.acme.certs."eldiron".extraDomains."www.immae.eu" = null;
17
18 services.myPhpfpm.poolConfigs.immae = ''
19 listen = /run/phpfpm/immae.sock
20 user = wwwrun
21 group = wwwrun
22 listen.owner = wwwrun
23 listen.group = wwwrun
24
25 pm = ondemand
26 pm.max_children = 5
27 pm.process_idle_timeout = 60
28
29 php_admin_value[open_basedir] = "${varDir}:/tmp"
30 '';
31 services.websites.production.modules = [ "proxy_fcgi" ];
32 services.websites.production.vhostConfs.immae = {
33 certName = "eldiron";
34 hosts = [ "www.immae.eu" ];
35 root = varDir;
36 extraConfig = [
37 ''
38 Use Stats www.immae.eu
39
40 <FilesMatch "\.php$">
41 SetHandler "proxy:unix:/run/phpfpm/immae.sock|fcgi://localhost"
42 </FilesMatch>
43
44 <Directory ${varDir}>
45 DirectoryIndex index.php index.htm index.html
46 Options Indexes FollowSymLinks MultiViews Includes
47 AllowOverride All
48 Require all granted
49 </Directory>
50
51 <Location /blog_old/>
52 Use LDAPConnect
53 Require ldap-group cn=blog,cn=immae.eu,ou=services,dc=immae,dc=eu
54 </Location>
55 ''
56 ];
57 };
58
59 security.acme.certs."eldiron".extraDomains."bouya.org" = null;
60 security.acme.certs."eldiron".extraDomains."www.bouya.org" = null;
61 services.websites.production.vhostConfs.bouya = {
62 certName = "eldiron";
63 hosts = [ "bouya.org" "www.bouya.org" ];
64 root = null;
65 extraConfig = [ ''
66 RedirectMatch 301 ^/((?!\.well-known.*$).*)$ https://www.normalesup.org/~bouya/
67 '' ];
68 };
69 };
70 }