]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/websites/tools/tools/phpbb.nix
Migrate phpbb and remove manual tools pages
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / tools / phpbb.nix
1 { lib, phpbb, gnused }:
2 rec {
3 backups = {
4 rootDir = varDir;
5 };
6 varDir = "/var/lib/phpbb";
7 activationScript = {
8 deps = [ "wrappers" ];
9 text = ''
10 if [ ! -d ${varDir} ]; then
11 install -m 0755 -o ${apache.user} -g ${apache.user} -d ${varDir}
12 cp -a ${phpbb}/vars/* ${varDir}
13 chown -R ${apache.user}:${apache.user} ${varDir}
14 fi
15 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
16 '';
17 };
18 webRoot = phpbb;
19 apache = rec {
20 user = "wwwrun";
21 group = "wwwrun";
22 modules = [ "proxy_fcgi" ];
23 webappName = "tools_phpbb";
24 root = "/run/current-system/webapps/${webappName}";
25 vhostConf = socket: ''
26 Alias /forum "${root}"
27 <Directory "${root}">
28 DirectoryIndex index.php
29 <FilesMatch "\.php$">
30 SetHandler "proxy:unix:${socket}|fcgi://localhost"
31 </FilesMatch>
32
33 AllowOverride All
34 Options FollowSymlinks
35 Require all granted
36 </Directory>
37 # add instal to the list after install
38 <LocationMatch "^/(cache|files|install|store)>
39 Require all denied
40 </LocationMatch>
41 '';
42 };
43 phpFpm = rec {
44 serviceDeps = [ "postgresql.service" ];
45 basedir = builtins.concatStringsSep ":" [ "/run/wrappers/bin/sendmail" phpbb varDir ];
46 pool = {
47 "listen.owner" = apache.user;
48 "listen.group" = apache.group;
49 "pm" = "ondemand";
50 "pm.max_children" = "60";
51 "pm.process_idle_timeout" = "60";
52
53 # Needed to avoid clashes in browser cookies (same domain)
54 "php_value[session.name]" = "PhpBBPHPSESSID";
55 "php_admin_value[open_basedir]" = "${basedir}:/tmp";
56 "php_admin_value[session.save_path]" = "${varDir}/phpSessions";
57 };
58 };
59 }