]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/websites/immae/production.nix
Add mysqli extension to immae website
[perso/Immae/Config/Nix.git] / modules / private / websites / immae / production.nix
1 { lib, pkgs, config, myconfig, ... }:
2 let
3 cfg = config.myServices.websites.immae.production;
4 varDir = "/var/lib/ftp/immae";
5 env = myconfig.env.websites.immae;
6 in {
7 options.myServices.websites.immae.production.enable = lib.mkEnableOption "enable Immae's website";
8
9 config = lib.mkIf cfg.enable {
10 services.webstats.sites = [ { name = "www.immae.eu"; } ];
11
12 services.phpfpm.pools.immae = {
13 listen = "/run/phpfpm/immae.sock";
14 extraConfig = ''
15 user = wwwrun
16 group = wwwrun
17 listen.owner = wwwrun
18 listen.group = wwwrun
19
20 pm = ondemand
21 pm.max_children = 5
22 pm.process_idle_timeout = 60
23
24 php_admin_value[open_basedir] = "${varDir}:/tmp"
25 '';
26 phpOptions = config.services.phpfpm.phpOptions + ''
27 extension=${pkgs.php}/lib/php/extensions/mysqli.so
28 '';
29 };
30 services.websites.env.production.modules = [ "proxy_fcgi" ];
31 services.websites.env.production.vhostConfs.immae = {
32 certName = "eldiron";
33 addToCerts = true;
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 services.websites.env.production.vhostConfs.bouya = {
60 certName = "eldiron";
61 addToCerts = true;
62 hosts = [ "bouya.org" "www.bouya.org" ];
63 root = null;
64 extraConfig = [ ''
65 RedirectMatch 301 ^/((?!\.well-known.*$).*)$ https://www.normalesup.org/~bouya/
66 '' ];
67 };
68 };
69 }