code organization

This commit is contained in:
bogale 2026-10-06 14:53:26 +09:00
commit bf5f9f799e
8 changed files with 227 additions and 209 deletions

View file

@ -68,50 +68,58 @@
};
};
};
nginx.virtualHosts."bogaledev.ru" = let
phpPool = ''
index index.php index.html;
location ~ \.php$ {
fastcgi_pass unix:${config.services.phpfpm.pools.php.socket};
}
'';
localNetworks = ''
allow fc00::/64;
allow fc01::/96;
allow fc02::/64;
allow 10.0.0.0/16;
allow 10.1.0.0/24;
allow 10.2.0.0/16;
deny all;
'';
in {
quic = true;
addSSL = true;
default = true;
root = "/srv/http";
useACMEHost = "bogaledev.ru";
extraConfig = ''
add_header Alt-Svc 'h3=":443"; ma=2592000' always;
add_header X-Content-Type-Options "nosniff" always;
'';
locations = {
"/".extraConfig = phpPool;
"/local/".extraConfig = "${phpPool} ${localNetworks}";
"/git/".proxyPass = "http://unix:/run/forgejo/forgejo.sock:/";
"/grafana/" = {
proxyWebsockets = true;
extraConfig = localNetworks;
proxyPass = "http://unix:/run/grafana/grafana.sock:/";
};
"/local/net/".extraConfig = ''
allow fc01::/64;
allow 10.1.0.0/16;
nginx = {
enable = true;
recommendedTlsSettings = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedBrotliSettings = true;
virtualHosts.main = let
phpPool = ''
index index.php index.html;
location ~ \.php$ {
fastcgi_pass unix:${config.services.phpfpm.pools.php.socket};
}
'';
localNetworks = ''
allow fc00::/64;
allow fc01::/96;
allow fc02::/64;
allow 10.0.0.0/16;
allow 10.1.0.0/24;
allow 10.2.0.0/16;
deny all;
'';
"/vw/" = {
proxyWebsockets = true;
extraConfig = localNetworks;
proxyPass = "http://localhost:46151";
in {
quic = true;
default = true;
forceSSL = true;
root = "/srv/http";
useACMEHost = "bogaledev.ru";
extraConfig = ''
add_header Alt-Svc 'h3=":443"; ma=2592000' always;
add_header X-Content-Type-Options 'nosniff' always;
'';
locations = {
"/".extraConfig = phpPool;
"/local/".extraConfig = "${phpPool} ${localNetworks}";
"/git/".proxyPass = "http://unix:/run/forgejo/forgejo.sock:/";
"/grafana/" = {
proxyWebsockets = true;
extraConfig = localNetworks;
proxyPass = "http://unix:/run/grafana/grafana.sock:/";
};
"/local/net/".extraConfig = ''
allow fc01::/64;
allow 10.1.0.0/16;
deny all;
'';
"/vw/" = {
proxyWebsockets = true;
extraConfig = localNetworks;
proxyPass = "http://localhost:46151";
};
};
};
};