]>
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 | ||
e34b3079 | 15 | security.acme.certs."ftp".extraDomainNames = [ "telio-tortay.immae.eu" ]; |
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 | |
73f88539 IB |
33 | "pm" = "dynamic"; |
34 | "pm.max_children" = "20"; | |
35 | "pm.start_servers" = "2"; | |
36 | "pm.min_spare_servers" = "1"; | |
37 | "pm.max_spare_servers" = "3"; | |
93531b30 | 38 | |
d3452fc5 IB |
39 | "php_admin_value[open_basedir]" = "/var/lib/php/sessions/telio_tortay:${varDir}:/tmp"; |
40 | "php_admin_value[session.save_path]" = "/var/lib/php/sessions/telio_tortay"; | |
5400b9b6 | 41 | }; |
93531b30 IB |
42 | phpOptions = config.services.phpfpm.phpOptions + '' |
43 | disable_functions = "mail" | |
f5761aac | 44 | ''; |
dcac3ec7 | 45 | phpPackage = pkgs.php72; |
93531b30 IB |
46 | }; |
47 | services.websites.env.production.modules = adminer.apache.modules ++ [ "proxy_fcgi" ]; | |
d3452fc5 IB |
48 | services.websites.env.production.vhostConfs.telio_tortay = { |
49 | certName = "telio_tortay"; | |
93531b30 | 50 | certMainHost = "telio-tortay.immae.eu"; |
78f73470 | 51 | hosts = ["telio-tortay.immae.eu" "realistesmedia.fr" "www.realistesmedia.fr" ]; |
93531b30 IB |
52 | root = varDir; |
53 | extraConfig = [ | |
5400b9b6 | 54 | (adminer.apache.vhostConf null) |
93531b30 IB |
55 | '' |
56 | Use Stats telio-tortay.immae.eu | |
57 | ServerAdmin ${env.server_admin} | |
58 | ErrorLog "${varDir}/logs/error_log" | |
59 | CustomLog "${varDir}/logs/access_log" combined | |
60 | ||
61 | <FilesMatch "\.php$"> | |
d3452fc5 | 62 | SetHandler "proxy:unix:${config.services.phpfpm.pools.telio_tortay.socket}|fcgi://localhost" |
93531b30 IB |
63 | </FilesMatch> |
64 | ||
32021034 IB |
65 | <Location /xmlrpc.php> |
66 | AllowOverride None | |
67 | Require all denied | |
68 | </Location> | |
93531b30 IB |
69 | <Directory ${varDir}/logs> |
70 | AllowOverride None | |
71 | Require all denied | |
72 | </Directory> | |
73 | <Directory ${varDir}> | |
74 | DirectoryIndex index.php index.htm index.html | |
75 | Options Indexes FollowSymLinks MultiViews Includes | |
76 | AllowOverride all | |
77 | Require all granted | |
78 | </Directory> | |
79 | '' | |
80 | ]; | |
81 | }; | |
82 | }; | |
83 | } |