1 { lib, pkgs, config, myconfig, mylibs, ... }:
3 adminer = pkgs.callPackage ../commons/adminer.nix {};
4 cfg = config.services.myWebsites.Jerome;
5 varDir = "/var/lib/ftp/jerome";
6 env = myconfig.env.websites.jerome;
8 options.services.myWebsites.Jerome = {
10 enable = lib.mkEnableOption "enable Jerome's website";
18 config = lib.mkIf cfg.production.enable {
19 services.myWebsites.commons.stats.enable = true;
20 services.myWebsites.commons.stats.sites = [
22 name = "naturaloutil.immae.eu";
23 conf = ./jerome_goaccess.conf;
27 security.acme.certs."ftp".extraDomains."naturaloutil.immae.eu" = null;
28 security.acme.certs."naturaloutil" = config.services.myCertificates.certConfig // {
29 domain = "naturaloutil.immae.eu";
33 dest = "webapps/prod-naturaloutil";
39 $mysql_user = '${env.mysql.user}' ;
40 $mysql_server = '${env.mysql.host}' ;
41 $mysql_base = '${env.mysql.name}' ;
42 $mysql_password = '${env.mysql.password}' ;
45 ${if env.mysql.host != "localhost" then ''
46 mysqli_options ($db, MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);
47 $db->ssl_set(NULL, NULL, "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt", NULL, NULL);
49 $database = connect_db($db, $mysql_server, $mysql_base, $mysql_user, $mysql_password);
53 services.myPhpfpm.serviceDependencies.jerome = [ "mysql.service" ];
54 services.myPhpfpm.poolConfigs.jerome = ''
55 listen = /run/phpfpm/naturaloutil.sock
63 pm.process_idle_timeout = 60
65 env[BDD_CONNECT] = "/var/secrets/webapps/prod-naturaloutil"
66 php_admin_value[open_basedir] = "/var/secrets/webapps/prod-naturaloutil:${varDir}:/tmp"
68 services.myPhpfpm.poolPhpConfigs.jerome = ''
69 extension=${pkgs.php}/lib/php/extensions/mysqli.so
71 services.myWebsites.production.modules = adminer.apache.modules ++ [ "proxy_fcgi" ];
72 services.myWebsites.production.vhostConfs.naturaloutil = {
73 certName = "naturaloutil";
74 hosts = ["naturaloutil.immae.eu" ];
77 adminer.apache.vhostConf
79 Use Stats naturaloutil.immae.eu
80 ServerAdmin ${env.server_admin}
81 ErrorLog "${varDir}/logs/error_log"
82 CustomLog "${varDir}/logs/access_log" combined
85 SetHandler "proxy:unix:/run/phpfpm/naturaloutil.sock|fcgi://localhost"
88 <Directory ${varDir}/logs>
93 DirectoryIndex index.php index.htm index.html
94 Options Indexes FollowSymLinks MultiViews Includes