chore(koi): migrated phpfront from desu-arm
This commit is contained in:
parent
40a9e3a6ec
commit
56e6ec5d8a
2 changed files with 73 additions and 0 deletions
|
@ -16,6 +16,7 @@
|
||||||
./services/coredns.nix
|
./services/coredns.nix
|
||||||
./services/sing-box.nix
|
./services/sing-box.nix
|
||||||
./services/nginx.nix
|
./services/nginx.nix
|
||||||
|
./services/phpfront.nix
|
||||||
./services/landing
|
./services/landing
|
||||||
|
|
||||||
./containers/uxplay.nix
|
./containers/uxplay.nix
|
||||||
|
|
72
hosts/koi/services/phpfront.nix
Normal file
72
hosts/koi/services/phpfront.nix
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
{ pkgs, lib, config, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.phpfpm.pools.phpfront = {
|
||||||
|
user = "phpfront";
|
||||||
|
settings = {
|
||||||
|
"listen.owner" = config.services.nginx.user;
|
||||||
|
"pm" = "dynamic";
|
||||||
|
"pm.max_children" = 32;
|
||||||
|
"pm.max_requests" = 500;
|
||||||
|
"pm.start_servers" = 2;
|
||||||
|
"pm.min_spare_servers" = 2;
|
||||||
|
"pm.max_spare_servers" = 5;
|
||||||
|
"php_admin_value[error_log]" = "stderr";
|
||||||
|
"php_admin_flag[log_errors]" = true;
|
||||||
|
"catch_workers_output" = true;
|
||||||
|
};
|
||||||
|
phpOptions = ''
|
||||||
|
short_open_tag = On
|
||||||
|
'';
|
||||||
|
phpEnv."PATH" = lib.makeBinPath [ pkgs.php ];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.nginx.virtualHosts."tei.su" = {
|
||||||
|
forceSSL = true;
|
||||||
|
useACMEHost = "tei.su";
|
||||||
|
|
||||||
|
root = "/srv/phpfront"; # outside flake for now, todo
|
||||||
|
extraConfig = ''
|
||||||
|
index index.html index.php;
|
||||||
|
'';
|
||||||
|
|
||||||
|
locations."/.well-known/" = {
|
||||||
|
extraConfig = ''
|
||||||
|
add_header 'Access-Control-Allow-Origin' '*';
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
locations."/_secure/" = {
|
||||||
|
# too lazy to migrate old logic for now, just error out
|
||||||
|
extraConfig = "return 403;";
|
||||||
|
};
|
||||||
|
|
||||||
|
locations."/" = {
|
||||||
|
extraConfig = ''
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
|
||||||
|
rewrite ^/?(\$|donate)$ /donate.php;
|
||||||
|
rewrite ^/ava320.jpg$ /ava320.php;
|
||||||
|
rewrite ^/pfrepl https://teidesu.github.io/protoflex/repl redirect;
|
||||||
|
rewrite ^/im\.mp3 https://vk.com/mp3/cc_ice_melts.mp3 redirect;
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
locations."~ \\.php$ " = {
|
||||||
|
extraConfig = ''
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_pass unix:${config.services.phpfpm.pools.phpfront.socket};
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include ${pkgs.nginx}/conf/fastcgi.conf;
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users.phpfront = {
|
||||||
|
isSystemUser = true;
|
||||||
|
createHome = true;
|
||||||
|
home = "/srv/phpfront";
|
||||||
|
group = "phpfront";
|
||||||
|
};
|
||||||
|
users.groups.phpfront = {};
|
||||||
|
}
|
Loading…
Reference in a new issue