52 lines
1.2 KiB
Nix
52 lines
1.2 KiB
Nix
{ pkgs, lib, config, ... }:
|
|
let
|
|
domain = "paraclub.at";
|
|
dataDir = "/var/www/${domain}";
|
|
in {
|
|
services.nginx.virtualHosts."${domain}" = {
|
|
forceSSL = true;
|
|
enableACME = true;
|
|
acmeRoot = null;
|
|
root = "${dataDir}";
|
|
serverAliases = [ "www.${domain}" ];
|
|
|
|
extraConfig = ''
|
|
if ($host != '${domain}') {
|
|
return 301 $scheme://${domain}$request_uri;
|
|
}
|
|
'';
|
|
|
|
locations."/favicon.ico".extraConfig = ''
|
|
log_not_found off;
|
|
access_log off;
|
|
'';
|
|
|
|
locations."/".extraConfig = ''
|
|
index index.html;
|
|
error_page 404 /de/404.html;
|
|
'';
|
|
|
|
locations."~* \.(js|jpg|gif|png|webp|css|woff2)$".extraConfig = ''
|
|
expires 365d;
|
|
add_header Pragma "public";
|
|
add_header Cache-Control "public";
|
|
'';
|
|
|
|
locations."~ [^/]\.php(/|$)".extraConfig = ''
|
|
deny all;
|
|
'';
|
|
};
|
|
users.users."${domain}" = {
|
|
isNormalUser = true;
|
|
createHome = true;
|
|
home = dataDir;
|
|
homeMode= "770";
|
|
#home = "/home/${domain}";
|
|
group = "nginx";
|
|
openssh.authorizedKeys.keys = [
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINkaoMNNBDqjvKrQg2YvXUBlJSZwvlKe3wS5cIDdR3pd"
|
|
];
|
|
};
|
|
users.groups.${domain} = {};
|
|
}
|