nixos/applications/skynet.ie/old_site.nix

52 lines
1.2 KiB
Nix

{year}: {
config,
pkgs,
lib,
inputs,
...
}:
with lib; {
imports = [];
config = {
services.skynet.dns.records = [
{
record = year;
r_type = "CNAME";
value = config.services.skynet.host.name;
}
];
services.nginx = {
virtualHosts = {
"${year}.skynet.ie" = {
forceSSL = true;
useACMEHost = "skynet";
root = "${inputs."skynet_website_${year}".defaultPackage."x86_64-linux"}";
# Handle any of the old php sites
# https://stackoverflow.com/a/21911610
locations = {
"/" = {
index = "index.html index.htm index.php";
tryFiles = "$uri $uri.html $uri/ @extensionless-php";
};
"~ \\.php$" = {
extraConfig = ''
fastcgi_pass unix:${config.services.phpfpm.pools.old_sites.socket};
fastcgi_index index.php;
'';
tryFiles = "$uri =404";
};
"@extensionless-php" = {
extraConfig = ''
rewrite ^(.*)$ $1.php last;
'';
};
};
};
};
};
};
}