]>
Commit | Line | Data |
---|---|---|
982dc1fa IB |
1 | { lib, pkgs, config, ... }: |
2 | let | |
305922df IB |
3 | cfg = config.myServices.websites.patrick_fodella.ecolyeu; |
4 | varDir = "/var/lib/ftp/patrick_fodella/ecolyeu_pessicart"; | |
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.ecolyeu.enable = lib.mkEnableOption "enable Patrick Fodella Ecolyeu's website"; |
982dc1fa IB |
9 | |
10 | config = lib.mkIf cfg.enable { | |
11 | services.webstats.sites = [ { name = "ecolyeu-pessicart-nice.fr"; } ]; | |
12 | ||
305922df IB |
13 | systemd.services.phpfpm-patrick_fodella_ecolyeu.after = lib.mkAfter [ "mysql.service" ]; |
14 | systemd.services.phpfpm-patrick_fodella_ecolyeu.wants = [ "mysql.service" ]; | |
15 | services.phpfpm.pools.patrick_fodella_ecolyeu = { | |
982dc1fa IB |
16 | user = apacheUser; |
17 | group = apacheGroup; | |
18 | settings = { | |
19 | "listen.owner" = apacheUser; | |
20 | "listen.group" = apacheGroup; | |
21 | ||
73f88539 IB |
22 | "pm" = "dynamic"; |
23 | "pm.max_children" = "20"; | |
24 | "pm.start_servers" = "2"; | |
25 | "pm.min_spare_servers" = "1"; | |
26 | "pm.max_spare_servers" = "3"; | |
982dc1fa | 27 | |
bbea22c0 IB |
28 | "php_admin_value[open_basedir]" = "${varDir}:/tmp"; |
29 | "php_admin_value[session.save_handler]" = "redis"; | |
30 | "php_admin_value[session.save_path]" = "'unix:///run/redis-php-sessions/redis.sock?persistent=1&prefix=PatrickFodella:Altermondia:'"; | |
982dc1fa IB |
31 | }; |
32 | phpOptions = config.services.phpfpm.phpOptions + '' | |
33 | disable_functions = "mail" | |
34 | ''; | |
bbea22c0 | 35 | phpPackage = pkgs.php72.withExtensions({ enabled, all }: enabled ++ [all.redis]); |
982dc1fa IB |
36 | }; |
37 | services.websites.env.production.modules = [ "proxy_fcgi" ]; | |
305922df | 38 | services.websites.env.production.vhostConfs.patrick_fodella_ecolyeu = { |
982dc1fa IB |
39 | certName = "patrick_fodella"; |
40 | certMainHost = "ecolyeu-pessicart-nice.fr"; | |
41 | hosts = ["ecolyeu-pessicart-nice.fr" "www.ecolyeu-pessicart-nice.fr" ]; | |
42 | root = varDir; | |
43 | extraConfig = [ | |
44 | '' | |
45 | Use Stats ecolyeu-pessicart-nice.fr | |
46 | ||
47 | RewriteEngine on | |
48 | RewriteCond "%{HTTP_HOST}" "!^www\.ecolyeu-pessicart-nice\.fr$" [NC] | |
49 | RewriteRule ^(.+)$ https://www.ecolyeu-pessicart-nice.fr$1 [R=302,L] | |
50 | ||
51 | <FilesMatch "\.php$"> | |
305922df | 52 | SetHandler "proxy:unix:${config.services.phpfpm.pools.patrick_fodella_ecolyeu.socket}|fcgi://localhost" |
982dc1fa IB |
53 | </FilesMatch> |
54 | ||
55 | <Location /xmlrpc.php> | |
56 | AllowOverride None | |
57 | Require all denied | |
58 | </Location> | |
59 | <Directory ${varDir}> | |
60 | DirectoryIndex index.php index.htm index.html | |
61 | Options Indexes FollowSymLinks MultiViews Includes | |
62 | AllowOverride all | |
63 | Require all granted | |
64 | </Directory> | |
65 | '' | |
66 | ]; | |
67 | }; | |
68 | }; | |
69 | } |