nicks-nix-config/hosts/Alaska/modules/nginx.nix

80 lines
1.9 KiB
Nix
Raw Permalink Normal View History

2023-04-05 21:10:58 -07:00
{ config, lib, pkgs, ... }:
{
2023-04-10 20:23:37 -07:00
security.acme = {
acceptTerms = true;
defaults.email = "nicholasyoungsumner@gmail.com";
};
2023-04-05 21:10:58 -07:00
services.nginx = {
enable = true;
2023-04-10 19:33:56 -07:00
commonHttpConfig = ''
real_ip_header CF-Connecting-IP;
add_header 'Referrer-Policy' 'origin-when-cross-origin';
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
'';
2023-04-05 21:10:58 -07:00
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts = {
2023-08-05 09:56:57 -07:00
"default" = {
default = true;
serverName = null;
# https://stackoverflow.com/a/42802777
locations."/".return = "444";
};
2023-04-10 19:33:56 -07:00
"jellyfin.nickiel.net" = {
forceSSL = true;
2023-04-10 20:23:37 -07:00
enableACME = true;
2023-04-10 19:33:56 -07:00
locations."/" = {
proxyPass = "http://127.0.0.1:8096/";
proxyWebsockets = true;
#extraConfig = "proxy_pass_header Authorization";
};
2023-04-10 19:33:56 -07:00
};
2023-11-21 17:38:07 -08:00
"iot.nickiel.net" = {
2023-11-21 18:04:09 -08:00
locations = {
"/" = {
2023-11-21 18:07:50 -08:00
root = "/Aurora/StaticSites/iot";
2023-11-21 18:04:09 -08:00
};
2024-02-03 18:30:36 -08:00
"/groovy_green_machine" = {
proxyPass = "http://10.0.184/";
extraConfig = ''
rewrite ^/groovy_green_machine(/.*)$ $1 break;
'';
2023-11-21 18:04:09 -08:00
};
2023-11-21 17:38:07 -08:00
};
};
2023-04-10 20:23:37 -07:00
"files.nickiel.net" = {
forceSSL = true;
enableACME = true;
locations."/".extraConfig = ''
allow 100.64.0.0/24;
deny all;
'';
2023-04-10 20:23:37 -07:00
};
2023-05-06 10:12:27 -07:00
"git.nickiel.net" = {
forceSSL = true;
enableACME = true;
locations."/".proxyPass = "http://127.0.0.1:3001";
};
2023-05-06 10:28:31 -07:00
2023-10-27 11:31:21 -07:00
"staticpages.nickiel.net" = {
forceSSL = true;
enableACME = true;
root = "/Aurora/StaticSites/static_pages/public";
};
2023-04-05 21:10:58 -07:00
};
};
}