]>
Commit | Line | Data |
---|---|---|
982dc1fa IB |
1 | { lib, pkgs, config, ... }: |
2 | let | |
305922df IB |
3 | cfg = config.myServices.websites.patrick_fodella.altermondia; |
4 | varDir = "/var/lib/ftp/patrick_fodella/altermondia"; | |
982dc1fa IB |
5 | apacheUser = config.services.httpd.Prod.user; |
6 | apacheGroup = config.services.httpd.Prod.group; | |
7 | in { | |
305922df | 8 | options.myServices.websites.patrick_fodella.altermondia.enable = lib.mkEnableOption "enable Patrick Fodella Altermondia's website"; |
982dc1fa IB |
9 | |
10 | config = lib.mkIf cfg.enable { | |
305922df | 11 | services.webstats.sites = [ { name = "altermondia.org"; } ]; |
982dc1fa | 12 | |
305922df | 13 | system.activationScripts.patrick_fodella_altermondia = { |
982dc1fa IB |
14 | deps = [ "httpd" ]; |
15 | text = '' | |
305922df | 16 | install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/patrick_fodella_altermondia |
982dc1fa IB |
17 | ''; |
18 | }; | |
305922df IB |
19 | systemd.services.phpfpm-patrick_fodella_altermondia.after = lib.mkAfter [ "mysql.service" ]; |
20 | systemd.services.phpfpm-patrick_fodella_altermondia.wants = [ "mysql.service" ]; | |
21 | services.phpfpm.pools.patrick_fodella_altermondia = { | |
982dc1fa IB |
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 | ||
305922df IB |
32 | "php_admin_value[open_basedir]" = "/var/lib/php/sessions/patrick_fodella_altermondia:${varDir}:/tmp"; |
33 | "php_admin_value[session.save_path]" = "/var/lib/php/sessions/patrick_fodella_altermondia"; | |
982dc1fa IB |
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" ]; | |
305922df | 41 | services.websites.env.production.vhostConfs.patrick_fodella_altermondia = { |
982dc1fa | 42 | certName = "patrick_fodella"; |
305922df IB |
43 | addToCerts = true; |
44 | hosts = ["altermondia.org" "www.altermondia.org" ]; | |
982dc1fa IB |
45 | root = varDir; |
46 | extraConfig = [ | |
47 | '' | |
305922df | 48 | Use Stats altermondia.org |
982dc1fa IB |
49 | |
50 | RewriteEngine on | |
305922df IB |
51 | RewriteCond "%{HTTP_HOST}" "!^altermondia\.org$" [NC] |
52 | RewriteRule ^(.+)$ https://altermondia.org$1 [R=302,L] | |
982dc1fa IB |
53 | |
54 | <FilesMatch "\.php$"> | |
305922df | 55 | SetHandler "proxy:unix:${config.services.phpfpm.pools.patrick_fodella_altermondia.socket}|fcgi://localhost" |
982dc1fa IB |
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 | } | |
305922df | 73 |