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