about summary refs log blame commit diff
path: root/ops/modules/www/base.nix
blob: 50fceff0fa4042041d3b6464fbc04470879aa7eb (plain) (tree)
1
2
3
4
5
6
7
8
9
                      


            




                                            






                                      
 

















                                                                        


                                                           


      
{ config, pkgs, ... }:

{
  config = {
    security.acme = {
      acceptTerms = true;
      defaults.email = "letsencrypt@tvl.su";
    };

    services.nginx = {
      enable = true;
      enableReload = true;

      recommendedTlsSettings = true;
      recommendedGzipSettings = true;
      recommendedProxySettings = true;

      commonHttpConfig = ''
        log_format json_combined escape=json
        '{'
            '"remote_addr":"$remote_addr",'
            '"method":"$request_method",'
            '"host":"$host",'
            '"uri":"$request_uri",'
            '"status":$status,'
            '"request_size":$request_length,'
            '"response_size":$body_bytes_sent,'
            '"response_time":$request_time,'
            '"referrer":"$http_referer",'
            '"user_agent":"$http_user_agent"'
        '}';

        access_log syslog:server=unix:/dev/log,nohostname json_combined;
      '';

      appendHttpConfig = ''
        add_header Permissions-Policy "interest-cohort=()";
      '';
    };
  };
}