mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/nixos/think-greater-cm.nix
This commit is contained in:
@@ -27,20 +27,10 @@ in
|
||||
|
||||
group = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = if cfg.enableNginx then "nginx" else defaultGroup;
|
||||
defaultText = "If `enableNginx` is true then `nginx` else ${defaultGroup}";
|
||||
default = defaultGroup;
|
||||
defaultText = "${defaultGroup}";
|
||||
description = ''
|
||||
Group under which the website runs. It is best to set this to the group
|
||||
of whatever webserver is being used as the frontend.
|
||||
'';
|
||||
};
|
||||
|
||||
enableNginx = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to enable nginx or not. If enabled, an nginx virtual host will
|
||||
be created for access.
|
||||
Group under which the website runs.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -198,8 +188,46 @@ in
|
||||
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.phpfpm.pools.think-greaterchiangmai = {
|
||||
users.users.${cfg.user} = {
|
||||
isSystemUser = true;
|
||||
home = cfg.dataDir;
|
||||
createHome = true;
|
||||
homeMode = "755";
|
||||
group = cfg.group;
|
||||
};
|
||||
users.groups.${cfg.group} = { };
|
||||
|
||||
services.phpfpm.pools.think-greaterchiangmai = {
|
||||
inherit (cfg) user group;
|
||||
settings = {
|
||||
"listen.owner" = config.services.nginx.user;
|
||||
"listen.group" = config.services.nginx.group;
|
||||
"listen.mode" = "0600";
|
||||
"pm" = lib.mkDefault "dynamic";
|
||||
"pm.max_children" = lib.mkDefault 10;
|
||||
"pm.max_requests" = lib.mkDefault 500;
|
||||
"pm.start_servers" = lib.mkDefault 2;
|
||||
"pm.min_spare_servers" = lib.mkDefault 1;
|
||||
"pm.max_spare_servers" = lib.mkDefault 3;
|
||||
};
|
||||
phpOptions = ''
|
||||
error_log = syslog
|
||||
log_errors = on
|
||||
'';
|
||||
};
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts."${cfg.domain}" = {
|
||||
root = "${cfg.stateDir}/public";
|
||||
locations."~ \\.php$".extraConfig = ''
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools.flarum.socket};
|
||||
fastcgi_index site.php;
|
||||
'';
|
||||
extraConfig = ''
|
||||
index index.php;
|
||||
include ${cfg.package}/share/php/flarum/.nginx.conf;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user