1 { lib, pkgs, config, ... }:
3 cfg = config.myServices.websites.ressourcerie_banon.production;
4 varDir = "/var/lib/ftp/ressourcerie_banon";
5 apacheUser = config.services.httpd.Prod.user;
6 apacheGroup = config.services.httpd.Prod.group;
8 options.myServices.websites.ressourcerie_banon.production.enable = lib.mkEnableOption "enable Ressourcerie Banon's website";
10 config = lib.mkIf cfg.enable {
11 services.webstats.sites = [ { name = "ressourcerie-banon.org"; } ];
13 system.activationScripts.ressourcerie_banon = {
16 install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/ressourcerie_banon
19 systemd.services.phpfpm-ressourcerie_banon.after = lib.mkAfter [ "mysql.service" ];
20 systemd.services.phpfpm-ressourcerie_banon.wants = [ "mysql.service" ];
21 services.phpfpm.pools.ressourcerie_banon = {
25 "listen.owner" = apacheUser;
26 "listen.group" = apacheGroup;
29 "pm.max_children" = "20";
30 "pm.start_servers" = "2";
31 "pm.min_spare_servers" = "1";
32 "pm.max_spare_servers" = "3";
34 "php_admin_value[open_basedir]" = "/var/lib/php/sessions/ressourcerie_banon:${varDir}:/tmp";
35 "php_admin_value[session.save_path]" = "/var/lib/php/sessions/ressourcerie_banon";
37 phpOptions = config.services.phpfpm.phpOptions + ''
38 disable_functions = "mail"
40 phpPackage = pkgs.php72;
42 services.websites.env.production.modules = [ "proxy_fcgi" ];
43 services.websites.env.production.vhostConfs.ressourcerie_banon = {
44 certName = "ressourcerie_banon";
45 certMainHost = "ressourcerie-banon.org";
46 hosts = ["ressourcerie-banon.org" "www.ressourcerie-banon.org" "le-garage-autonome.org"
47 "www.le-garage-autonome.org"];
51 Use Stats ressourcerie-banon.org
54 RewriteCond "%{HTTP_HOST}" "!^ressourcerie-banon\.org$" [NC]
55 RewriteRule ^(.+)$ https://ressourcerie-banon.org$1 [R=302,L]
58 SetHandler "proxy:unix:${config.services.phpfpm.pools.ressourcerie_banon.socket}|fcgi://localhost"
62 DirectoryIndex index.php index.htm index.html
63 Options Indexes FollowSymLinks MultiViews Includes