aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2020-09-17 17:22:48 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2020-09-17 17:22:48 +0200
commit982dc1fabf71cc91ef4409848dd1952c7e6f479f (patch)
treea9c19f38fafc7c9930c5d7cd30a3e81761a5f9a1 /modules/private/websites
parent0aa7e23c659590b0960eade3419c0991b0a8b500 (diff)
downloadNix-982dc1fabf71cc91ef4409848dd1952c7e6f479f.tar.gz
Nix-982dc1fabf71cc91ef4409848dd1952c7e6f479f.tar.zst
Nix-982dc1fabf71cc91ef4409848dd1952c7e6f479f.zip
Add Patrick Fodella’s website
Diffstat (limited to 'modules/private/websites')
-rw-r--r--modules/private/websites/default.nix2
-rw-r--r--modules/private/websites/patrick_fodella/production.nix72
2 files changed, 74 insertions, 0 deletions
diff --git a/modules/private/websites/default.nix b/modules/private/websites/default.nix
index 9467055..90a8c1a 100644
--- a/modules/private/websites/default.nix
+++ b/modules/private/websites/default.nix
@@ -284,6 +284,8 @@ in
284 maison_bbc.enable = true; 284 maison_bbc.enable = true;
285 }; 285 };
286 286
287 patrick_fodella.production.enable = true;
288
287 piedsjaloux = { 289 piedsjaloux = {
288 integration.enable = true; 290 integration.enable = true;
289 production.enable = true; 291 production.enable = true;
diff --git a/modules/private/websites/patrick_fodella/production.nix b/modules/private/websites/patrick_fodella/production.nix
new file mode 100644
index 0000000..2812cf7
--- /dev/null
+++ b/modules/private/websites/patrick_fodella/production.nix
@@ -0,0 +1,72 @@
1{ lib, pkgs, config, ... }:
2let
3 cfg = config.myServices.websites.patrick_fodella.production;
4 varDir = "/var/lib/ftp/patrick_fodella";
5 apacheUser = config.services.httpd.Prod.user;
6 apacheGroup = config.services.httpd.Prod.group;
7in {
8 options.myServices.websites.patrick_fodella.production.enable = lib.mkEnableOption "enable Patrick Fodella's website";
9
10 config = lib.mkIf cfg.enable {
11 services.webstats.sites = [ { name = "ecolyeu-pessicart-nice.fr"; } ];
12
13 system.activationScripts.patrick_fodella = {
14 deps = [ "httpd" ];
15 text = ''
16 install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/patrick_fodella
17 '';
18 };
19 systemd.services.phpfpm-patrick_fodella.after = lib.mkAfter [ "mysql.service" ];
20 systemd.services.phpfpm-patrick_fodella.wants = [ "mysql.service" ];
21 services.phpfpm.pools.patrick_fodella = {
22 user = apacheUser;
23 group = apacheGroup;
24 settings = {
25 "listen.owner" = apacheUser;
26 "listen.group" = apacheGroup;
27
28 "pm" = "ondemand";
29 "pm.max_children" = "5";
30 "pm.process_idle_timeout" = "60";
31
32 "php_admin_value[open_basedir]" = "/var/lib/php/sessions/patrick_fodella:${varDir}:/tmp";
33 "php_admin_value[session.save_path]" = "/var/lib/php/sessions/patrick_fodella";
34 };
35 phpOptions = config.services.phpfpm.phpOptions + ''
36 disable_functions = "mail"
37 '';
38 phpPackage = pkgs.php72;
39 };
40 services.websites.env.production.modules = [ "proxy_fcgi" ];
41 services.websites.env.production.vhostConfs.patrick_fodella = {
42 certName = "patrick_fodella";
43 certMainHost = "ecolyeu-pessicart-nice.fr";
44 hosts = ["ecolyeu-pessicart-nice.fr" "www.ecolyeu-pessicart-nice.fr" ];
45 root = varDir;
46 extraConfig = [
47 ''
48 Use Stats ecolyeu-pessicart-nice.fr
49
50 RewriteEngine on
51 RewriteCond "%{HTTP_HOST}" "!^www\.ecolyeu-pessicart-nice\.fr$" [NC]
52 RewriteRule ^(.+)$ https://www.ecolyeu-pessicart-nice.fr$1 [R=302,L]
53
54 <FilesMatch "\.php$">
55 SetHandler "proxy:unix:${config.services.phpfpm.pools.patrick_fodella.socket}|fcgi://localhost"
56 </FilesMatch>
57
58 <Location /xmlrpc.php>
59 AllowOverride None
60 Require all denied
61 </Location>
62 <Directory ${varDir}>
63 DirectoryIndex index.php index.htm index.html
64 Options Indexes FollowSymLinks MultiViews Includes
65 AllowOverride all
66 Require all granted
67 </Directory>
68 ''
69 ];
70 };
71 };
72}