aboutsummaryrefslogtreecommitdiff
path: root/nix/modules/nginx.nix
blob: e8c468287b83ee0438247f9382350c28d42699fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{ config, services, ... }:
{
  services.nginx = {
    enable = true;

    # Use recommended settings
    recommendedGzipSettings = true;
    recommendedOptimisation = true;
    recommendedProxySettings = true;
    recommendedTlsSettings = true;

    # Only allow PFS-enabled ciphers with AES256
    sslCiphers = "AES256+EECDH:AES256+EDH:!aNULL";

    appendHttpConfig = ''
  # Add HSTS header with preloading to HTTPS requests.
  # Adding this header to HTTP requests is discouraged
  map $scheme $hsts_header {
	https   "max-age=31536000; includeSubdomains; preload";
  }
  add_header Strict-Transport-Security $hsts_header;

  # Enable CSP for your services.
  #add_header Content-Security-Policy "script-src 'self'; object-src 'none'; base-uri 'none';" always;

  # Minimize information leaked to other domains
  add_header 'Referrer-Policy' 'origin-when-cross-origin';

  # Disable embedding as a frame
  add_header X-Frame-Options DENY;

  # Prevent injection of code in other mime types (XSS Attacks)
  add_header X-Content-Type-Options nosniff;

  # This might create errors
  proxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";
'';

    virtualHosts = {
	"ret2pop.net" = {
	  # addSSL = true;
	  # enableACME = true;
	  root = "/home/preston/ret2pop-website/";
	};
    };
  };
}