diff options
Diffstat (limited to 'modules/private/websites/jerome/naturaloutil.nix')
-rw-r--r-- | modules/private/websites/jerome/naturaloutil.nix | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/modules/private/websites/jerome/naturaloutil.nix b/modules/private/websites/jerome/naturaloutil.nix deleted file mode 100644 index 0974ce3..0000000 --- a/modules/private/websites/jerome/naturaloutil.nix +++ /dev/null | |||
@@ -1,97 +0,0 @@ | |||
1 | { lib, pkgs, config, ... }: | ||
2 | let | ||
3 | adminer = pkgs.callPackage ../commons/adminer.nix { inherit config; }; | ||
4 | cfg = config.myServices.websites.jerome.naturaloutil; | ||
5 | varDir = "/var/lib/ftp/jerome"; | ||
6 | env = config.myEnv.websites.jerome; | ||
7 | apacheUser = config.services.httpd.Prod.user; | ||
8 | apacheGroup = config.services.httpd.Prod.group; | ||
9 | secretsPath = config.secrets.fullPaths."websites/jerome/naturaloutil"; | ||
10 | in { | ||
11 | options.myServices.websites.jerome.naturaloutil.enable = lib.mkEnableOption "enable Jerome Naturaloutil's website"; | ||
12 | |||
13 | config = lib.mkIf cfg.enable { | ||
14 | services.webstats.sites = [ { name = "naturaloutil.immae.eu"; } ]; | ||
15 | |||
16 | security.acme.certs."ftp".extraDomains."naturaloutil.immae.eu" = null; | ||
17 | |||
18 | secrets.keys."websites/jerome/naturaloutil" = { | ||
19 | user = apacheUser; | ||
20 | group = apacheGroup; | ||
21 | permissions = "0400"; | ||
22 | text = '' | ||
23 | <?php | ||
24 | $mysql_user = '${env.mysql.user}' ; | ||
25 | $mysql_server = '${env.mysql.host}' ; | ||
26 | $mysql_base = '${env.mysql.database}' ; | ||
27 | $mysql_password = '${env.mysql.password}' ; | ||
28 | //connect to db | ||
29 | $db = mysqli_init(); | ||
30 | ${if env.mysql.host != "localhost" then '' | ||
31 | mysqli_options ($db, MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true); | ||
32 | $db->ssl_set(NULL, NULL, "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt", NULL, NULL); | ||
33 | '' else ""} | ||
34 | $database = connect_db($db, $mysql_server, $mysql_base, $mysql_user, $mysql_password); | ||
35 | ?> | ||
36 | ''; | ||
37 | }; | ||
38 | system.activationScripts.jerome_naturaloutil = { | ||
39 | deps = [ "httpd" ]; | ||
40 | text = '' | ||
41 | install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/jerome_naturaloutil | ||
42 | ''; | ||
43 | }; | ||
44 | systemd.services.phpfpm-jerome_naturaloutil.after = lib.mkAfter [ "mysql.service" ]; | ||
45 | systemd.services.phpfpm-jerome_naturaloutil.wants = [ "mysql.service" ]; | ||
46 | services.phpfpm.pools.jerome_naturaloutil = { | ||
47 | user = apacheUser; | ||
48 | group = apacheGroup; | ||
49 | settings = { | ||
50 | "listen.owner" = apacheUser; | ||
51 | "listen.group" = apacheGroup; | ||
52 | |||
53 | "pm" = "ondemand"; | ||
54 | "pm.max_children" = "5"; | ||
55 | "pm.process_idle_timeout" = "60"; | ||
56 | |||
57 | "php_admin_value[open_basedir]" = "/var/lib/php/sessions/jerome_naturaloutil:${secretsPath}:${varDir}:/tmp"; | ||
58 | "php_admin_value[session.save_path]" = "/var/lib/php/sessions/jerome_naturaloutil"; | ||
59 | }; | ||
60 | phpEnv = { | ||
61 | BDD_CONNECT = secretsPath; | ||
62 | }; | ||
63 | phpPackage = pkgs.php72; | ||
64 | }; | ||
65 | services.websites.env.production.modules = adminer.apache.modules ++ [ "proxy_fcgi" ]; | ||
66 | services.websites.env.production.vhostConfs.jerome_naturaloutil = { | ||
67 | certName = "jerome"; | ||
68 | certMainHost = "naturaloutil.immae.eu"; | ||
69 | hosts = ["naturaloutil.immae.eu" ]; | ||
70 | root = varDir; | ||
71 | extraConfig = [ | ||
72 | (adminer.apache.vhostConf null) | ||
73 | '' | ||
74 | Use Stats naturaloutil.immae.eu | ||
75 | ServerAdmin ${env.server_admin} | ||
76 | ErrorLog "${varDir}/logs/error_log" | ||
77 | CustomLog "${varDir}/logs/access_log" combined | ||
78 | |||
79 | <FilesMatch "\.php$"> | ||
80 | SetHandler "proxy:unix:${config.services.phpfpm.pools.jerome_naturaloutil.socket}|fcgi://localhost" | ||
81 | </FilesMatch> | ||
82 | |||
83 | <Directory ${varDir}/logs> | ||
84 | AllowOverride None | ||
85 | Require all denied | ||
86 | </Directory> | ||
87 | <Directory ${varDir}> | ||
88 | DirectoryIndex index.php index.htm index.html | ||
89 | Options Indexes FollowSymLinks MultiViews Includes | ||
90 | AllowOverride None | ||
91 | Require all granted | ||
92 | </Directory> | ||
93 | '' | ||
94 | ]; | ||
95 | }; | ||
96 | }; | ||
97 | } | ||