52 lines
1.1 KiB
Nix
52 lines
1.1 KiB
Nix
{ pkgs, lib, config, ... }:
|
|
let
|
|
domain = "cloonar.dev";
|
|
dataDir = "/var/www/${domain}";
|
|
in {
|
|
|
|
services.webstack.instances."${domain}" = {
|
|
authorizedKeys = [
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINrxGbJ8vqOLMySIst+e2Qq06bPLPh+7fmPRM27kMBgC"
|
|
];
|
|
|
|
locations."/".extraConfig = ''
|
|
index index.html;
|
|
'';
|
|
|
|
locations."~* \.(jpe?g|png)$".extraConfig = ''
|
|
set $red Z;
|
|
|
|
if ($http_accept ~* "webp") {
|
|
set $red A;
|
|
}
|
|
|
|
if (-f $document_root/webp/$request_uri.webp) {
|
|
set $red "''${red}B";
|
|
}
|
|
|
|
if ($red = "AB") {
|
|
add_header Vary Accept;
|
|
rewrite ^ /webp/$request_uri.webp;
|
|
}
|
|
'';
|
|
|
|
locations."^~ /vcards/".extraConfig = ''
|
|
location ~ /\.env {
|
|
deny all;
|
|
return 404;
|
|
}
|
|
|
|
# Determine if the requested file exists
|
|
try_files $uri $uri/ /vcards/index.php$is_args$args;
|
|
'';
|
|
|
|
locations."~* \.(js|jpg|gif|png|webp|css|woff2)$".extraConfig = ''
|
|
expires 365d;
|
|
add_header Pragma "public";
|
|
add_header Cache-Control "public";
|
|
'';
|
|
|
|
phpPackage = pkgs.php;
|
|
};
|
|
}
|