]>
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; | |
792ccef2 IB |
7 | binEnvPaths = [ pkgs.zip ]; |
8 | binEnv = pkgs.buildEnv { paths = binEnvPaths; name = "bin-env";}; | |
982dc1fa | 9 | in { |
305922df | 10 | options.myServices.websites.patrick_fodella.altermondia.enable = lib.mkEnableOption "enable Patrick Fodella Altermondia's website"; |
982dc1fa IB |
11 | |
12 | config = lib.mkIf cfg.enable { | |
305922df | 13 | services.webstats.sites = [ { name = "altermondia.org"; } ]; |
982dc1fa | 14 | |
305922df IB |
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 = { | |
982dc1fa IB |
18 | user = apacheUser; |
19 | group = apacheGroup; | |
20 | settings = { | |
21 | "listen.owner" = apacheUser; | |
22 | "listen.group" = apacheGroup; | |
23 | ||
792ccef2 IB |
24 | "pm" = "dynamic"; |
25 | "pm.max_children" = "20"; | |
26 | "pm.start_servers" = "2"; | |
27 | "pm.min_spare_servers" = "1"; | |
28 | "pm.max_spare_servers" = "3"; | |
982dc1fa | 29 | |
792ccef2 | 30 | "env[BIN_ENV]" = "${binEnv}/bin"; |
bbea22c0 IB |
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:'"; | |
982dc1fa IB |
34 | }; |
35 | phpOptions = config.services.phpfpm.phpOptions + '' | |
36 | disable_functions = "mail" | |
37 | ''; | |
bbea22c0 | 38 | phpPackage = pkgs.php72.withExtensions({ enabled, all }: enabled ++ [all.redis]); |
982dc1fa IB |
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 | 43 | addToCerts = true; |
8ece2579 | 44 | certMainHost = "altermondia.org"; |
305922df | 45 | hosts = ["altermondia.org" "www.altermondia.org" ]; |
982dc1fa IB |
46 | root = varDir; |
47 | extraConfig = [ | |
48 | '' | |
305922df | 49 | Use Stats altermondia.org |
982dc1fa IB |
50 | |
51 | RewriteEngine on | |
305922df IB |
52 | RewriteCond "%{HTTP_HOST}" "!^altermondia\.org$" [NC] |
53 | RewriteRule ^(.+)$ https://altermondia.org$1 [R=302,L] | |
982dc1fa IB |
54 | |
55 | <FilesMatch "\.php$"> | |
305922df | 56 | SetHandler "proxy:unix:${config.services.phpfpm.pools.patrick_fodella_altermondia.socket}|fcgi://localhost" |
982dc1fa IB |
57 | </FilesMatch> |
58 | ||
59 | <Location /xmlrpc.php> | |
60 | AllowOverride None | |
61 | Require all denied | |
62 | </Location> | |
63 | <Directory ${varDir}> | |
64 | DirectoryIndex index.php index.htm index.html | |
65 | Options Indexes FollowSymLinks MultiViews Includes | |
66 | AllowOverride all | |
67 | Require all granted | |
68 | </Directory> | |
69 | '' | |
70 | ]; | |
71 | }; | |
72 | }; | |
73 | } | |
305922df | 74 |