summaryrefslogtreecommitdiff
path: root/gnu/services
diff options
context:
space:
mode:
authorSimen Endsjø <simendsjo@gmail.com>2022-09-16 09:50:37 +0200
committerLudovic Courtès <ludo@gnu.org>2022-09-26 23:29:38 +0200
commit75e7c094615f063b1018526c4c72838dd3173989 (patch)
tree4c39cc0c45dc7daa6e902ff9585173d9e36042d2 /gnu/services
parent172207924e8491e654623d0a7e7503f80fddafc3 (diff)
services: nginx: Don't emit empty fields
An empty root or index field is an error in nginx. * gnu/services/web.scm (emit-nginx-server-config): Don't emit root or index fields when they are empty Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/web.scm9
1 files changed, 7 insertions, 2 deletions
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 5bac496f01..e347f5dbcc 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -14,6 +14,7 @@
;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2020, 2021 Alexandru-Sergiu Marton <brown121407@posteo.ro>
+;;; Copyright © 2022 Simen Endsjø <simendsjo@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -646,8 +647,12 @@ of index files."
" server_name " (config-domain-strings server-name) ";\n"
(and/l ssl-certificate " ssl_certificate " <> ";\n")
(and/l ssl-certificate-key " ssl_certificate_key " <> ";\n")
- " root " root ";\n"
- " index " (config-index-strings index) ";\n"
+ (if (not (equal? "" root))
+ (list " root " root ";\n")
+ "")
+ (if (not (null? index))
+ (list " index " (config-index-strings index) ";\n")
+ "")
(if (not (nil? try-files))
(and/l (config-index-strings try-files) " try_files " <> ";\n")
"")