]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/teliotortay/production.nix
Upgrade nixos
[perso/Immae/Config/Nix.git] / modules / private / websites / teliotortay / production.nix
CommitLineData
ab8f306d 1{ lib, pkgs, config, ... }:
93531b30 2let
5400b9b6 3 adminer = pkgs.callPackage ../commons/adminer.nix { inherit config; };
93531b30
IB
4 cfg = config.myServices.websites.telioTortay.production;
5 varDir = "/var/lib/ftp/telio_tortay";
ab8f306d 6 env = config.myEnv.websites.telioTortay;
93531b30
IB
7in {
8 options.myServices.websites.telioTortay.production.enable = lib.mkEnableOption "enable Telio Tortay's website";
9
10 config = lib.mkIf cfg.enable {
11 services.webstats.sites = [ { name = "telio-tortay.immae.eu"; } ];
12
5400b9b6 13 security.acme.certs."ftp".extraDomains."telio-tortay.immae.eu" = null;
93531b30
IB
14
15 system.activationScripts.telio-tortay = {
16 deps = [ "httpd" ];
17 text = ''
18 install -m 0755 -o wwwrun -g wwwrun -d /var/lib/ftp/telio_tortay/logs
19 install -m 0755 -o wwwrun -g wwwrun -d /var/lib/php/sessions/telio-tortay
20 '';
21 };
22 systemd.services.phpfpm-telio-tortay.after = lib.mkAfter [ "mysql.service" ];
23 systemd.services.phpfpm-telio-tortay.wants = [ "mysql.service" ];
24 services.phpfpm.pools.telio-tortay = {
5400b9b6
IB
25 user = "wwwrun";
26 group = "wwwrun";
27 settings = {
28 "listen.owner" = "wwwrun";
29 "listen.group" = "wwwrun";
93531b30 30
5400b9b6
IB
31 "pm" = "ondemand";
32 "pm.max_children" = "5";
33 "pm.process_idle_timeout" = "60";
93531b30 34
5400b9b6
IB
35 "php_admin_value[open_basedir]" = "/var/lib/php/sessions/telio-tortay:${varDir}:/tmp";
36 "php_admin_value[session.save_path]" = "/var/lib/php/sessions/telio-tortay";
37 };
93531b30
IB
38 phpOptions = config.services.phpfpm.phpOptions + ''
39 disable_functions = "mail"
40 extension=${pkgs.php}/lib/php/extensions/mysqli.so
41 '';
42 };
43 services.websites.env.production.modules = adminer.apache.modules ++ [ "proxy_fcgi" ];
44 services.websites.env.production.vhostConfs.telio-tortay = {
45 certName = "telio-tortay";
46 certMainHost = "telio-tortay.immae.eu";
78f73470 47 hosts = ["telio-tortay.immae.eu" "realistesmedia.fr" "www.realistesmedia.fr" ];
93531b30
IB
48 root = varDir;
49 extraConfig = [
5400b9b6 50 (adminer.apache.vhostConf null)
93531b30
IB
51 ''
52 Use Stats telio-tortay.immae.eu
53 ServerAdmin ${env.server_admin}
54 ErrorLog "${varDir}/logs/error_log"
55 CustomLog "${varDir}/logs/access_log" combined
56
57 <FilesMatch "\.php$">
5400b9b6 58 SetHandler "proxy:unix:${config.services.phpfpm.pools.telio-tortay.socket}|fcgi://localhost"
93531b30
IB
59 </FilesMatch>
60
61 <Directory ${varDir}/logs>
62 AllowOverride None
63 Require all denied
64 </Directory>
65 <Directory ${varDir}>
66 DirectoryIndex index.php index.htm index.html
67 Options Indexes FollowSymLinks MultiViews Includes
68 AllowOverride all
69 Require all granted
70 </Directory>
71 ''
72 ];
73 };
74 };
75}