Working website for AFAF.

I had to add various directives that I borrowed from a previous install.
It's essentially PHP black magic.

I also had to prevent NixOS from overwriting the permissions on the PHP
users home directory so that nginx would serve the static files as well.
This commit is contained in:
Eli Ribble 2025-04-11 15:33:54 -07:00
parent a24fae4dc8
commit 484a4b2a4e
1 changed files with 27 additions and 3 deletions

View File

@ -68,14 +68,36 @@
virtualHosts."new.anythingforafriend.com" = { virtualHosts."new.anythingforafriend.com" = {
addSSL = true; addSSL = true;
enableACME = true; enableACME = true;
extraConfig = ''
error_log /var/log/nginx/error.log warn;
fastcgi_intercept_errors on;
include ${pkgs.nginx}/conf/mime.types;
index index.php index.html;
'';
locations."/" = { locations."/" = {
extraConfig = '' extraConfig = ''
try_files $uri /index.php/$request_uri;
'';
};
locations."~ \\.php" = {
extraConfig = ''
try_files $uri =404;
set $script $uri;
set $path_info "";
if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
set $path_info $2;
}
fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:${config.services.phpfpm.pools.anythingforafriend.socket}; fastcgi_pass unix:${config.services.phpfpm.pools.anythingforafriend.socket};
include ${pkgs.nginx}/conf/fastcgi.conf; include ${pkgs.nginx}/conf/fastcgi.conf;
fastcgi_param URI $uri;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_NAME $script;
fastcgi_param SCRIPT_FILENAME $document_root$script;
''; '';
root = "/var/www/new.anythingforafriend.com";
}; };
root = "/var/www/new.anythingforafriend.com";
}; };
}; };
services.openssh = { services.openssh = {
@ -91,12 +113,14 @@
time.timeZone = "America/Phoenix"; time.timeZone = "America/Phoenix";
users.groups.deploy = {}; users.groups.deploy = {};
users.groups.www-data = {}; users.groups.nginx = {};
users.users.www-data = { users.users.www-data = {
isSystemUser = true; isSystemUser = true;
createHome = true; createHome = true;
extraGroups = [ "nginx" ];
home = "/var/www/new.anythingforafriend.com"; home = "/var/www/new.anythingforafriend.com";
group = "www-data"; homeMode = "770";
group = "nginx";
}; };
users.users.deploy = { users.users.deploy = {
extraGroups = [ "deploy" ]; extraGroups = [ "deploy" ];