+++ /dev/null
-{ lib, pkgs, config, ... }:
-let
- cfg = config.myServices.websites.emilia.atelierfringant;
- varDir = "/var/lib/ftp/emilia/atelierfringant";
- apacheUser = config.services.httpd.Prod.user;
- apacheGroup = config.services.httpd.Prod.group;
-in {
- options.myServices.websites.emilia.atelierfringant.enable = lib.mkEnableOption "enable Émilia's website";
-
- config = lib.mkIf cfg.enable {
- system.activationScripts.emilia_atelierfringant = {
- deps = [ "httpd" ];
- text = ''
- install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/ftp/emilia/atelierfringant
- install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/emilia
- '';
- };
- systemd.services.phpfpm-emilia_atelierfringant.after = lib.mkAfter [ "mysql.service" ];
- systemd.services.phpfpm-emilia_atelierfringant.wants = [ "mysql.service" ];
- services.phpfpm.pools.emilia_atelierfringant = {
- user = apacheUser;
- group = apacheGroup;
- settings = {
- "listen.owner" = apacheUser;
- "listen.group" = apacheGroup;
-
- "pm" = "ondemand";
- "pm.max_children" = "5";
- "pm.process_idle_timeout" = "60";
-
- "php_admin_value[open_basedir]" = "/var/lib/php/sessions/emilia:${varDir}:/tmp";
- "php_admin_value[session.save_path]" = "/var/lib/php/sessions/emilia";
- };
- phpOptions = config.services.phpfpm.phpOptions + ''
- disable_functions = "mail"
- '';
- phpPackage = pkgs.php72;
- };
- services.websites.env.production.modules = [ "proxy_fcgi" ];
- services.websites.env.production.vhostConfs.emilia_atelierfringant = {
- certName = "emilia";
- certMainHost = "atelierfringant.org";
- hosts = ["atelierfringant.org" "www.atelierfringant.org" ];
- root = varDir;
- extraConfig = [
- ''
- <FilesMatch "\.php$">
- SetHandler "proxy:unix:${config.services.phpfpm.pools.emilia_atelierfringant.socket}|fcgi://localhost"
- </FilesMatch>
-
- <Location /xmlrpc.php>
- AllowOverride None
- Require all denied
- </Location>
- <Directory ${varDir}>
- DirectoryIndex index.php index.htm index.html
- Options Indexes FollowSymLinks MultiViews Includes
- AllowOverride all
- Require all granted
- </Directory>
- ''
- ];
- };
- };
-}