From d8f21b3ca3962c725eddc3d6513acaeca25c2e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Fri, 21 Oct 2016 13:17:39 +0200 Subject: [PATCH] acme: provide full nginx example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 2af7382f76a6523f1220637b3ec49ad25a02b040) Signed-off-by: Domen Kožar --- nixos/modules/security/acme.xml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/nixos/modules/security/acme.xml b/nixos/modules/security/acme.xml index 15ed4c04a23d..c8a2171eff75 100644 --- a/nixos/modules/security/acme.xml +++ b/nixos/modules/security/acme.xml @@ -74,7 +74,27 @@ options for the security.acme module. +security.acme.certs."foo.example.com" = { + webroot = "/var/www/challenges"; + email = "foo@example.com"; + user = "nginx"; + group = "nginx"; + postRun = "systemctl restart nginx.service"; +}; services.nginx.httpConfig = '' + server { + server_name foo.example.com; + listen [::]:80; + + location /.well-known/acme-challenge { + root /var/www/challenges; + } + + location / { + return 301 https://$host$request_uri; + } + } + server { server_name foo.example.com; listen 443 ssl;