nixos-config/mastus/www.nix

37 lines
798 B
Nix

{ config, pkgs, ... }:
{
systemd.services.createNginxDH = rec {
path = [ pkgs.openssl ];
serviceConfig = { Type = "oneshot"; RemainAfterExit = "yes"; };
wantedBy = [ "nginx.service" ];
before = wantedBy;
script = ''
if [ ! -f /etc/nginx/dhparam.pem ]; then
mkdir -p /etc/nginx/
openssl dhparam 2048 >/etc/nginx/dhparam.pem
fi
'';
};
services.nginx = {
enable = true;
httpConfig = ''
server {
listen [::]:80;
listen 80;
server_name _;
location /.well-known/acme-challenge {
default_type text/plain;
alias /var/lib/acme/www/.well-known/acme-challenge;
}
location / {
rewrite ^(.*) https://gebner.org$1 permanent;
}
}
'';
};
}