Skip to content

Commit

Permalink
Set nginx settings globally
Browse files Browse the repository at this point in the history
  • Loading branch information
peterablehmann committed May 21, 2024
1 parent bee824c commit 498e597
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 21 deletions.
1 change: 1 addition & 0 deletions modules/common/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
./acme.nix
./boot.nix
./exporters.nix
./nginx.nix
./nix.nix
./ssh.nix
./tailscale.nix
Expand Down
10 changes: 10 additions & 0 deletions modules/common/nginx.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
networking.firewall.allowedTCPPorts = [ 80 443 ];
services.nginx = {
recommendedTlsSettings = true;
recommendedOptimisation = true;
recommendedGzipSettings = true;
recommendedProxySettings = true;
enable = true;
};
}
9 changes: 1 addition & 8 deletions modules/monitoring/grafana.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,14 @@ in

networking.domains.subDomains."${domain}" = { };

networking.firewall.allowedTCPPorts = [ 80 443 ];
services.nginx = {
enable = true;
recommendedTlsSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
virtualHosts."${domain}" = {
services.nginx.virtualHosts."${domain}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://${config.services.grafana.settings.server.http_addr}:${builtins.toString config.services.grafana.settings.server.http_port }";
proxyWebsockets = true;
};
};
};

services.grafana = {
enable = true;
Expand Down
15 changes: 2 additions & 13 deletions nodes/sync/syncthing.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,15 @@ let
domain = "sync.xnee.net";
in
{
networking.firewall.allowedTCPPorts = [ 80 443 ];
security.acme = {
defaults.email = "[email protected]";
acceptTerms = true;
certs."${domain}" = { };
};
security.acme.certs."${domain}" = { };

services.nginx = {
enable = true;
recommendedTlsSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
virtualHosts."${domain}" = {
services.nginx.virtualHosts."${domain}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://${config.services.syncthing.guiAddress}";
};
};
};

services.syncthing = {
enable = true;
Expand Down

0 comments on commit 498e597

Please sign in to comment.