feat: initial amzebs config
This commit is contained in:
49
hosts/amzebs-01/sites/ebs.cloonar.dev.nix
Normal file
49
hosts/amzebs-01/sites/ebs.cloonar.dev.nix
Normal file
@@ -0,0 +1,49 @@
|
||||
{ pkgs, lib, config, ... }:
|
||||
let
|
||||
domain = "ebs.cloonar.dev";
|
||||
dataDir = "/var/www/${domain}";
|
||||
in {
|
||||
services.nginx.virtualHosts."${domain}" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
# Use HTTP-01 challenge for Let's Encrypt
|
||||
acmeRoot = lib.mkForce "/var/lib/acme/acme-challenge";
|
||||
root = "${dataDir}";
|
||||
|
||||
locations."/favicon.ico".extraConfig = ''
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
'';
|
||||
|
||||
# React client-side routing support
|
||||
locations."/".extraConfig = ''
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
'';
|
||||
|
||||
# Cache static assets
|
||||
locations."~* \\.(js|jpg|gif|png|webp|css|woff2|svg|ico)$".extraConfig = ''
|
||||
expires 365d;
|
||||
add_header Pragma "public";
|
||||
add_header Cache-Control "public";
|
||||
'';
|
||||
|
||||
# Deny PHP execution
|
||||
locations."~ [^/]\\.php(/|$)".extraConfig = ''
|
||||
deny all;
|
||||
'';
|
||||
};
|
||||
|
||||
users.users."${domain}" = {
|
||||
isNormalUser = true;
|
||||
createHome = true;
|
||||
home = dataDir;
|
||||
homeMode = "770";
|
||||
group = "nginx";
|
||||
openssh.authorizedKeys.keys = [
|
||||
# Add deployment SSH key here
|
||||
];
|
||||
};
|
||||
|
||||
users.groups.${domain} = {};
|
||||
}
|
||||
Reference in New Issue
Block a user