1 { lib, pkgs, config, ... }:
3 cfg = config.myServices.websites.patrick_fodella.altermondia;
4 varDir = "/var/lib/ftp/patrick_fodella/altermondia";
5 apacheUser = config.services.httpd.Prod.user;
6 apacheGroup = config.services.httpd.Prod.group;
7 binEnvPaths = [ pkgs.zip ];
8 binEnv = pkgs.buildEnv { paths = binEnvPaths; name = "bin-env";};
10 options.myServices.websites.patrick_fodella.altermondia.enable = lib.mkEnableOption "enable Patrick Fodella Altermondia's website";
12 config = lib.mkIf cfg.enable {
13 services.webstats.sites = [ { name = "altermondia.org"; } ];
15 systemd.services.phpfpm-patrick_fodella_altermondia.after = lib.mkAfter [ "mysql.service" ];
16 systemd.services.phpfpm-patrick_fodella_altermondia.wants = [ "mysql.service" ];
17 services.phpfpm.pools.patrick_fodella_altermondia = {
21 "listen.owner" = apacheUser;
22 "listen.group" = apacheGroup;
25 "pm.max_children" = "20";
26 "pm.start_servers" = "2";
27 "pm.min_spare_servers" = "1";
28 "pm.max_spare_servers" = "3";
30 "env[BIN_ENV]" = "${binEnv}/bin";
31 "php_admin_value[open_basedir]" = "${binEnv}:${builtins.concatStringsSep ":" binEnvPaths}:${varDir}:/tmp";
32 "php_admin_value[session.save_handler]" = "redis";
33 "php_admin_value[session.save_path]" = "'unix:///run/redis-php-sessions/redis.sock?persistent=1&prefix=PatrickFodella:Altermondia:'";
35 phpOptions = config.services.phpfpm.phpOptions + ''
36 disable_functions = "mail"
38 phpPackage = pkgs.php72.withExtensions({ enabled, all }: enabled ++ [all.redis]);
40 services.websites.env.production.modules = [ "proxy_fcgi" ];
41 services.websites.env.production.vhostConfs.patrick_fodella_altermondia = {
42 certName = "patrick_fodella";
44 hosts = ["altermondia.org" "www.altermondia.org" ];
48 Use Stats altermondia.org
51 RewriteCond "%{HTTP_HOST}" "!^altermondia\.org$" [NC]
52 RewriteRule ^(.+)$ https://altermondia.org$1 [R=302,L]
55 SetHandler "proxy:unix:${config.services.phpfpm.pools.patrick_fodella_altermondia.socket}|fcgi://localhost"
58 <Location /xmlrpc.php>
63 DirectoryIndex index.php index.htm index.html
64 Options Indexes FollowSymLinks MultiViews Includes