88 lines
2.3 KiB
Nix
88 lines
2.3 KiB
Nix
{ config, pkgs, ... }: {
|
|
services = {
|
|
nginx = {
|
|
clientMaxBodySize = "4G";
|
|
enable = true;
|
|
recommendedBrotliSettings = true;
|
|
recommendedGzipSettings = true;
|
|
recommendedOptimisation = true;
|
|
recommendedProxySettings = true;
|
|
recommendedTlsSettings = true;
|
|
virtualHosts = {
|
|
nextcloud-local.listen = [
|
|
{
|
|
addr = "localhost";
|
|
port = 45837;
|
|
}
|
|
];
|
|
main =
|
|
let
|
|
localNetworks = ''
|
|
allow 10.0.0.0/16;
|
|
allow fc00::/64;
|
|
deny all;
|
|
'';
|
|
phpPool = ''
|
|
index index.php index.html;
|
|
location ~ \.php$ {
|
|
fastcgi_pass unix:${config.services.phpfpm.pools.php.socket};
|
|
}
|
|
'';
|
|
in
|
|
{
|
|
default = true;
|
|
extraConfig = ''
|
|
add_header Alt-Svc 'h3=":443"; ma=2592000' always;
|
|
add_header X-Content-Type-Options 'nosniff' always;
|
|
'';
|
|
forceSSL = true;
|
|
locations = {
|
|
"/".extraConfig = phpPool;
|
|
"/git/".proxyPass = "http://unix:/run/forgejo/forgejo.sock:/";
|
|
"/grafana/".proxyPass = "http://unix:/run/grafana/grafana.sock:/";
|
|
"/local/".extraConfig = "${phpPool} ${localNetworks}";
|
|
"/nextcloud/".proxyPass = "http://localhost:45837/";
|
|
"/vaultwarden/" = {
|
|
extraConfig = localNetworks;
|
|
proxyPass = "http://localhost:46151";
|
|
proxyWebsockets = true;
|
|
};
|
|
};
|
|
quic = true;
|
|
root = "/srv/http";
|
|
useACMEHost = "bogaledev.ru";
|
|
};
|
|
};
|
|
};
|
|
postgresql = {
|
|
enable = true;
|
|
ensureDatabases = [
|
|
"grafana"
|
|
"php"
|
|
];
|
|
ensureUsers =
|
|
let
|
|
user = name: {
|
|
ensureDBOwnership = true;
|
|
inherit name;
|
|
};
|
|
in
|
|
map user [
|
|
"grafana"
|
|
"php"
|
|
];
|
|
};
|
|
postgresqlBackup = {
|
|
compression = "none";
|
|
databases = [
|
|
"forgejo"
|
|
"grafana"
|
|
"nextcloud"
|
|
"php"
|
|
"vaultwarden"
|
|
];
|
|
enable = true;
|
|
startAt = "16:00";
|
|
};
|
|
};
|
|
}
|