diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-04-18 16:10:56 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-04-20 01:51:48 +0200 |
commit | d3452fc59b9839846225fd254926c64a9c71f071 (patch) | |
tree | a98a0958b826ac4b2ab137720edf0195c65dd958 /modules/private/websites/telio_tortay | |
parent | 514f9ec3beec470c4445be690673a0ceab9115b4 (diff) | |
download | Nix-d3452fc59b9839846225fd254926c64a9c71f071.tar.gz Nix-d3452fc59b9839846225fd254926c64a9c71f071.tar.zst Nix-d3452fc59b9839846225fd254926c64a9c71f071.zip |
Refactor websites
Diffstat (limited to 'modules/private/websites/telio_tortay')
-rw-r--r-- | modules/private/websites/telio_tortay/production.nix | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/modules/private/websites/telio_tortay/production.nix b/modules/private/websites/telio_tortay/production.nix new file mode 100644 index 0000000..130f4db --- /dev/null +++ b/modules/private/websites/telio_tortay/production.nix | |||
@@ -0,0 +1,77 @@ | |||
1 | { lib, pkgs, config, ... }: | ||
2 | let | ||
3 | adminer = pkgs.callPackage ../commons/adminer.nix { inherit config; }; | ||
4 | cfg = config.myServices.websites.telio_tortay.production; | ||
5 | varDir = "/var/lib/ftp/telio_tortay"; | ||
6 | env = config.myEnv.websites.telio_tortay; | ||
7 | apacheUser = config.services.httpd.Prod.user; | ||
8 | apacheGroup = config.services.httpd.Prod.group; | ||
9 | in { | ||
10 | options.myServices.websites.telio_tortay.production.enable = lib.mkEnableOption "enable Telio Tortay's website"; | ||
11 | |||
12 | config = lib.mkIf cfg.enable { | ||
13 | services.webstats.sites = [ { name = "telio-tortay.immae.eu"; } ]; | ||
14 | |||
15 | security.acme.certs."ftp".extraDomains."telio-tortay.immae.eu" = null; | ||
16 | |||
17 | system.activationScripts.telio_tortay = { | ||
18 | deps = [ "httpd" ]; | ||
19 | text = '' | ||
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 | ||
22 | ''; | ||
23 | }; | ||
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; | ||
29 | settings = { | ||
30 | "listen.owner" = apacheUser; | ||
31 | "listen.group" = apacheGroup; | ||
32 | |||
33 | "pm" = "ondemand"; | ||
34 | "pm.max_children" = "5"; | ||
35 | "pm.process_idle_timeout" = "60"; | ||
36 | |||
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"; | ||
39 | }; | ||
40 | phpOptions = config.services.phpfpm.phpOptions + '' | ||
41 | disable_functions = "mail" | ||
42 | extension=${pkgs.php}/lib/php/extensions/mysqli.so | ||
43 | ''; | ||
44 | }; | ||
45 | services.websites.env.production.modules = adminer.apache.modules ++ [ "proxy_fcgi" ]; | ||
46 | services.websites.env.production.vhostConfs.telio_tortay = { | ||
47 | certName = "telio_tortay"; | ||
48 | certMainHost = "telio-tortay.immae.eu"; | ||
49 | hosts = ["telio-tortay.immae.eu" "realistesmedia.fr" "www.realistesmedia.fr" ]; | ||
50 | root = varDir; | ||
51 | extraConfig = [ | ||
52 | (adminer.apache.vhostConf null) | ||
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$"> | ||
60 | SetHandler "proxy:unix:${config.services.phpfpm.pools.telio_tortay.socket}|fcgi://localhost" | ||
61 | </FilesMatch> | ||
62 | |||
63 | <Directory ${varDir}/logs> | ||
64 | AllowOverride None | ||
65 | Require all denied | ||
66 | </Directory> | ||
67 | <Directory ${varDir}> | ||
68 | DirectoryIndex index.php index.htm index.html | ||
69 | Options Indexes FollowSymLinks MultiViews Includes | ||
70 | AllowOverride all | ||
71 | Require all granted | ||
72 | </Directory> | ||
73 | '' | ||
74 | ]; | ||
75 | }; | ||
76 | }; | ||
77 | } | ||