2015-10-25 08:29:49 +00:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
systemd.services.createNginxDH = {
|
|
|
|
path = [ pkgs.openssl ];
|
|
|
|
serviceConfig = { Type = "oneshot"; RemainAfterExit = "yes"; };
|
|
|
|
wantedBy = [ "nginx.service" ];
|
|
|
|
script = ''
|
|
|
|
if [ ! -f /etc/nginx/dhparam.pem ]; then
|
|
|
|
mkdir -p /etc/nginx/
|
|
|
|
openssl dhparam 2048 >/etc/nginx/dhparam.pem
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
2015-12-05 12:41:20 +00:00
|
|
|
httpConfig = ''
|
|
|
|
server {
|
|
|
|
listen [::]:80;
|
|
|
|
listen 80;
|
|
|
|
server_name _;
|
|
|
|
|
|
|
|
location /.well-known/acme-challenge {
|
|
|
|
default_type text/plain;
|
|
|
|
alias /etc/sslcerts/acmeroot/.well-known/acme-challenge;
|
|
|
|
}
|
|
|
|
|
2015-12-05 12:59:38 +00:00
|
|
|
location / {
|
|
|
|
rewrite ^(.*) https://gebner.org$1 permanent;
|
|
|
|
}
|
2015-12-05 12:41:20 +00:00
|
|
|
}
|
|
|
|
'';
|
2015-10-25 08:29:49 +00:00
|
|
|
};
|
|
|
|
}
|