init nginx
This commit is contained in:
parent
2aa7fa8a47
commit
176726501a
2 changed files with 29 additions and 0 deletions
|
@ -2,5 +2,6 @@
|
|||
{
|
||||
imports = [
|
||||
./backup.nix
|
||||
./nginx.nix
|
||||
];
|
||||
}
|
||||
|
|
28
modules/nginx.nix
Normal file
28
modules/nginx.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{ config, lib, ...}:
|
||||
let
|
||||
cfg = config.my.nginx;
|
||||
in
|
||||
{
|
||||
options.my.nginx = {
|
||||
enable = lib.mkEnableOption "nginx";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
recommendedTlsSettings = true;
|
||||
recommendedGzipSettings = true;
|
||||
recommendedOptimisation = true;
|
||||
recommendedZstdSettings = true;
|
||||
recommendedProxySettings = true;
|
||||
|
||||
# HSTS for all domains
|
||||
appendHttpConfig = ''
|
||||
map $scheme $hsts_header {
|
||||
https "max-age=31536000; includeSubdomains; preload";
|
||||
}
|
||||
add_header Strict-Transport-Security $hsts_header;
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue