{ env, yourls, yourls-plugins }:
rec {
activationScript = {
deps = [ "httpd" ];
text = ''
install -m 0755 -o ${apache.user} -g ${apache.group} -d /var/lib/php/sessions/yourls
'';
};
keys = [{
dest = "webapps/tools-yourls";
user = apache.user;
group = apache.group;
permissions = "0400";
text = ''
SetHandler "proxy:unix:${socket}|fcgi://localhost"
AllowOverride None
Require all granted
RewriteEngine On
RewriteBase /url/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /url/yourls-loader.php [L]
DirectoryIndex index.php
'';
};
phpFpm = rec {
serviceDeps = [ "mysql.service" "openldap.service" ];
basedir = builtins.concatStringsSep ":" (
[ webRoot "/var/secrets/webapps/tools-yourls" ]
++ webRoot.plugins);
pool = {
"listen.owner" = apache.user;
"listen.group" = apache.group;
"pm" = "ondemand";
"pm.max_children" = "60";
"pm.process_idle_timeout" = "60";
# Needed to avoid clashes in browser cookies (same domain)
"php_value[session.name]" = "YourlsPHPSESSID";
"php_admin_value[open_basedir]" = "${basedir}:/tmp:/var/lib/php/sessions/yourls";
"php_admin_value[session.save_path]" = "/var/lib/php/sessions/yourls";
};
};
}