summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Lassieur <clement@lassieur.org>2017-12-09 12:59:12 +0100
committerClément Lassieur <clement@lassieur.org>2017-12-18 12:03:14 +0100
commit8b223ceac4ff0781e95d69362875f87cff03f4d6 (patch)
tree4a501621f9a6d30c314552fe1944cfbc2f5f70c0
parentf1a2b1cb20cdc0c7f3e58bab4acea39eabfbd5a5 (diff)
services: nginx: Replace 'http-port' and 'https-port' with 'listen'.
* doc/guix.texi (Web Services, Version Control Services): Update accordingly. * gnu/services/certbot.scm (certbot-nginx-server-configurations): Likewise. * gnu/services/version-control.scm (%cgit-configuration-nginx): Likewise. * gnu/services/web.scm (<nginx-server-configuration>, emit-nginx-server-config): Likewise. * gnu/tests/version-control.scm (%cgit-configuration-nginx, %git-nginx-configuration): Likewise. * gnu/tests/web.scm (%nginx-servers, %php-fpm-nginx-server-blocks): Likewise.
-rw-r--r--doc/guix.texi20
-rw-r--r--gnu/services/certbot.scm4
-rw-r--r--gnu/services/version-control.scm3
-rw-r--r--gnu/services/web.scm16
-rw-r--r--gnu/tests/version-control.scm7
-rw-r--r--gnu/tests/web.scm6
6 files changed, 25 insertions, 31 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 242e54fd152..e44478cbf40 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -14938,17 +14938,15 @@ Data type representing the configuration of an nginx server block.
14938This type has the following parameters: 14938This type has the following parameters:
14939 14939
14940@table @asis 14940@table @asis
14941@item @code{http-port} (default: @code{80}) 14941@item @code{listen} (default: @code{'("80" "443 ssl")})
14942Nginx will listen for HTTP connection on this port. Set it at @code{#f} if 14942Each @code{listen} directive sets the address and port for IP, or the
14943nginx should not listen for HTTP (non secure) connection for this 14943path for a UNIX-domain socket on which the server will accept requests.
14944@dfn{server block}. 14944Both address and port, or only address or only port can be specified.
14945An address may also be a hostname, for example:
14945 14946
14946@item @code{https-port} (default: @code{443}) 14947@example
14947Nginx will listen for HTTPS connection on this port. Set it at @code{#f} if 14948'("127.0.0.1:8000" "127.0.0.1" "8000" "*:8000" "localhost:8000")
14948nginx should not listen for HTTPS (secure) connection for this @dfn{server block}. 14949@end example
14949
14950Note that nginx can listen for HTTP and HTTPS connections in the same
14951@dfn{server block}.
14952 14950
14953@item @code{server-name} (default: @code{(list 'default)}) 14951@item @code{server-name} (default: @code{(list 'default)})
14954A list of server names this server represents. @code{'default} represents the 14952A list of server names this server represents. @code{'default} represents the
@@ -17689,7 +17687,7 @@ serve the default @file{/srv/git} over HTTPS might be:
17689 (server-blocks 17687 (server-blocks
17690 (list 17688 (list
17691 (nginx-server-configuration 17689 (nginx-server-configuration
17692 (http-port #f) 17690 (listen '("443 ssl"))
17693 (server-name "git.my-host.org") 17691 (server-name "git.my-host.org")
17694 (ssl-certificate 17692 (ssl-certificate
17695 "/etc/letsencrypt/live/git.my-host.org/fullchain.pem") 17693 "/etc/letsencrypt/live/git.my-host.org/fullchain.pem")
diff --git a/gnu/services/certbot.scm b/gnu/services/certbot.scm
index 0d72a4b700d..8aac2638b3b 100644
--- a/gnu/services/certbot.scm
+++ b/gnu/services/certbot.scm
@@ -1,6 +1,7 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is> 2;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
3;;; Copyright © 2016 Sou Bunnbu <iyzsong@member.fsf.org> 3;;; Copyright © 2016 Sou Bunnbu <iyzsong@member.fsf.org>
4;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
4;;; 5;;;
5;;; This file is part of GNU Guix. 6;;; This file is part of GNU Guix.
6;;; 7;;;
@@ -97,8 +98,7 @@
97 (map 98 (map
98 (lambda (host) 99 (lambda (host)
99 (nginx-server-configuration 100 (nginx-server-configuration
100 (http-port 80) 101 (listen '("80"))
101 (https-port #f)
102 (ssl-certificate #f) 102 (ssl-certificate #f)
103 (ssl-certificate-key #f) 103 (ssl-certificate-key #f)
104 (server-name (list host)) 104 (server-name (list host))
diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm
index fce2ce1c25d..6bf656949af 100644
--- a/gnu/services/version-control.scm
+++ b/gnu/services/version-control.scm
@@ -2,6 +2,7 @@
2;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is> 2;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
3;;; Copyright © 2016 Sou Bunnbu <iyzsong@member.fsf.org> 3;;; Copyright © 2016 Sou Bunnbu <iyzsong@member.fsf.org>
4;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com> 4;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
5;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
5;;; 6;;;
6;;; This file is part of GNU Guix. 7;;; This file is part of GNU Guix.
7;;; 8;;;
@@ -231,7 +232,7 @@ access to exported repositories under @file{/srv/git}."
231 "fastcgi_param HTTP_HOST $server_name;" 232 "fastcgi_param HTTP_HOST $server_name;"
232 "fastcgi_pass 127.0.0.1:9000;"))))) 233 "fastcgi_pass 127.0.0.1:9000;")))))
233 (try-files (list "$uri" "@cgit")) 234 (try-files (list "$uri" "@cgit"))
234 (https-port #f) 235 (listen '("80"))
235 (ssl-certificate #f) 236 (ssl-certificate #f)
236 (ssl-certificate-key #f)))) 237 (ssl-certificate-key #f))))
237 238
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 582cf535cb8..8a16f50de44 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -5,6 +5,7 @@
5;;; Copyright © 2016, 2017 Julien Lepiller <julien@lepiller.eu> 5;;; Copyright © 2016, 2017 Julien Lepiller <julien@lepiller.eu>
6;;; Copyright © 2017 Christopher Baines <mail@cbaines.net> 6;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
7;;; Copyright © 2017 nee <nee-git@hidamari.blue> 7;;; Copyright © 2017 nee <nee-git@hidamari.blue>
8;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
8;;; 9;;;
9;;; This file is part of GNU Guix. 10;;; This file is part of GNU Guix.
10;;; 11;;;
@@ -49,8 +50,7 @@
49 <nginx-server-configuration> 50 <nginx-server-configuration>
50 nginx-server-configuration 51 nginx-server-configuration
51 nginx-server-configuration? 52 nginx-server-configuration?
52 nginx-server-configuration-http-port 53 nginx-server-configuration-listen
53 nginx-server-configuartion-https-port
54 nginx-server-configuration-server-name 54 nginx-server-configuration-server-name
55 nginx-server-configuration-root 55 nginx-server-configuration-root
56 nginx-server-configuration-locations 56 nginx-server-configuration-locations
@@ -135,10 +135,8 @@
135(define-record-type* <nginx-server-configuration> 135(define-record-type* <nginx-server-configuration>
136 nginx-server-configuration make-nginx-server-configuration 136 nginx-server-configuration make-nginx-server-configuration
137 nginx-server-configuration? 137 nginx-server-configuration?
138 (http-port nginx-server-configuration-http-port 138 (listen nginx-server-configuration-listen
139 (default 80)) 139 (default '("80" "443 ssl")))
140 (https-port nginx-server-configuration-https-port
141 (default 443))
142 (server-name nginx-server-configuration-server-name 140 (server-name nginx-server-configuration-server-name
143 (default (list 'default))) 141 (default (list 'default)))
144 (root nginx-server-configuration-root 142 (root nginx-server-configuration-root
@@ -225,8 +223,7 @@ of index files."
225 " }\n")))) 223 " }\n"))))
226 224
227(define (emit-nginx-server-config server) 225(define (emit-nginx-server-config server)
228 (let ((http-port (nginx-server-configuration-http-port server)) 226 (let ((listen (nginx-server-configuration-listen server))
229 (https-port (nginx-server-configuration-https-port server))
230 (server-name (nginx-server-configuration-server-name server)) 227 (server-name (nginx-server-configuration-server-name server))
231 (ssl-certificate (nginx-server-configuration-ssl-certificate server)) 228 (ssl-certificate (nginx-server-configuration-ssl-certificate server))
232 (ssl-certificate-key 229 (ssl-certificate-key
@@ -245,8 +242,7 @@ of index files."
245 '()))) 242 '())))
246 (list 243 (list
247 " server {\n" 244 " server {\n"
248 (and/l http-port " listen " (number->string <>) ";\n") 245 (map (lambda (directive) (list " listen " directive ";\n")) listen)
249 (and/l https-port " listen " (number->string <>) " ssl;\n")
250 " server_name " (config-domain-strings server-name) ";\n" 246 " server_name " (config-domain-strings server-name) ";\n"
251 (and/l ssl-certificate " ssl_certificate " <> ";\n") 247 (and/l ssl-certificate " ssl_certificate " <> ";\n")
252 (and/l ssl-certificate-key " ssl_certificate_key " <> ";\n") 248 (and/l ssl-certificate-key " ssl_certificate_key " <> ";\n")
diff --git a/gnu/tests/version-control.scm b/gnu/tests/version-control.scm
index 2cbacf0ef97..7367861b051 100644
--- a/gnu/tests/version-control.scm
+++ b/gnu/tests/version-control.scm
@@ -1,6 +1,7 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com> 2;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
3;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org> 3;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
4;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
4;;; 5;;;
5;;; This file is part of GNU Guix. 6;;; This file is part of GNU Guix.
6;;; 7;;;
@@ -78,8 +79,7 @@
78 "fastcgi_param HTTP_HOST $server_name;" 79 "fastcgi_param HTTP_HOST $server_name;"
79 "fastcgi_pass 127.0.0.1:9000;"))))) 80 "fastcgi_pass 127.0.0.1:9000;")))))
80 (try-files (list "$uri" "@cgit")) 81 (try-files (list "$uri" "@cgit"))
81 (http-port 19418) 82 (listen '("19418"))
82 (https-port #f)
83 (ssl-certificate #f) 83 (ssl-certificate #f)
84 (ssl-certificate-key #f)))) 84 (ssl-certificate-key #f))))
85 85
@@ -211,8 +211,7 @@ HTTP-PORT."
211 (server-blocks 211 (server-blocks
212 (list 212 (list
213 (nginx-server-configuration 213 (nginx-server-configuration
214 (http-port 19418) 214 (listen '("19418"))
215 (https-port #f)
216 (ssl-certificate #f) 215 (ssl-certificate #f)
217 (ssl-certificate-key #f) 216 (ssl-certificate-key #f)
218 (locations 217 (locations
diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm
index e975cb8300e..f1214fb5fd6 100644
--- a/gnu/tests/web.scm
+++ b/gnu/tests/web.scm
@@ -1,6 +1,7 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2017 Christopher Baines <mail@cbaines.net> 3;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
4;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
4;;; 5;;;
5;;; This file is part of GNU Guix. 6;;; This file is part of GNU Guix.
6;;; 7;;;
@@ -47,7 +48,7 @@
47 ;; Server blocks. 48 ;; Server blocks.
48 (list (nginx-server-configuration 49 (list (nginx-server-configuration
49 (root "/srv") 50 (root "/srv")
50 (http-port 8042)))) 51 (listen '("8042" "443 ssl")))))
51 52
52(define %nginx-os 53(define %nginx-os
53 ;; Operating system under test. 54 ;; Operating system under test.
@@ -153,8 +154,7 @@ echo(\"Computed by php:\".((string)(2+3)));
153 (root "/srv") 154 (root "/srv")
154 (locations 155 (locations
155 (list (nginx-php-location))) 156 (list (nginx-php-location)))
156 (http-port 8042) 157 (listen "8042")
157 (https-port #f)
158 (ssl-certificate #f) 158 (ssl-certificate #f)
159 (ssl-certificate-key #f)))) 159 (ssl-certificate-key #f))))
160 160