guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/02: services: nginx: Replace 'http-port' and 'https-port' with 'liste


From: Clément Lassieur
Subject: 01/02: services: nginx: Replace 'http-port' and 'https-port' with 'listen'.
Date: Mon, 18 Dec 2017 06:03:48 -0500 (EST)

snape pushed a commit to branch master
in repository guix.

commit 8b223ceac4ff0781e95d69362875f87cff03f4d6
Author: Clément Lassieur <address@hidden>
Date:   Sat Dec 9 12:59:12 2017 +0100

    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.
---
 doc/guix.texi                    | 20 +++++++++-----------
 gnu/services/certbot.scm         |  4 ++--
 gnu/services/version-control.scm |  3 ++-
 gnu/services/web.scm             | 16 ++++++----------
 gnu/tests/version-control.scm    |  7 +++----
 gnu/tests/web.scm                |  6 +++---
 6 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 242e54f..e44478c 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -14938,17 +14938,15 @@ Data type representing the configuration of an nginx 
server block.
 This type has the following parameters:
 
 @table @asis
address@hidden @code{http-port} (default: @code{80})
-Nginx will listen for HTTP connection on this port.  Set it at @code{#f} if
-nginx should not listen for HTTP (non secure) connection for this
address@hidden block}.
address@hidden @code{listen} (default: @code{'("80" "443 ssl")})
+Each @code{listen} directive sets the address and port for IP, or the
+path for a UNIX-domain socket on which the server will accept requests.
+Both address and port, or only address or only port can be specified.
+An address may also be a hostname, for example:
 
address@hidden @code{https-port} (default: @code{443})
-Nginx will listen for HTTPS connection on this port.  Set it at @code{#f} if
-nginx should not listen for HTTPS (secure) connection for this @dfn{server 
block}.
-
-Note that nginx can listen for HTTP and HTTPS connections in the same
address@hidden block}.
address@hidden
+'("127.0.0.1:8000" "127.0.0.1" "8000" "*:8000" "localhost:8000")
address@hidden example
 
 @item @code{server-name} (default: @code{(list 'default)})
 A 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:
           (server-blocks
            (list
             (nginx-server-configuration
-             (http-port #f)
+             (listen '("443 ssl"))
              (server-name "git.my-host.org")
              (ssl-certificate
               "/etc/letsencrypt/live/git.my-host.org/fullchain.pem")
diff --git a/gnu/services/certbot.scm b/gnu/services/certbot.scm
index 0d72a4b..8aac263 100644
--- a/gnu/services/certbot.scm
+++ b/gnu/services/certbot.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 ng0 <address@hidden>
 ;;; Copyright © 2016 Sou Bunnbu <address@hidden>
+;;; Copyright © 2017 Clément Lassieur <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -97,8 +98,7 @@
      (map
       (lambda (host)
         (nginx-server-configuration
-         (http-port 80)
-         (https-port #f)
+         (listen '("80"))
          (ssl-certificate #f)
          (ssl-certificate-key #f)
          (server-name (list host))
diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm
index fce2ce1..6bf6569 100644
--- a/gnu/services/version-control.scm
+++ b/gnu/services/version-control.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2016 ng0 <address@hidden>
 ;;; Copyright © 2016 Sou Bunnbu <address@hidden>
 ;;; Copyright © 2017 Oleg Pykhalov <address@hidden>
+;;; Copyright © 2017 Clément Lassieur <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -231,7 +232,7 @@ access to exported repositories under @file{/srv/git}."
                "fastcgi_param HTTP_HOST $server_name;"
                "fastcgi_pass 127.0.0.1:9000;")))))
     (try-files (list "$uri" "@cgit"))
-    (https-port #f)
+    (listen '("80"))
     (ssl-certificate #f)
     (ssl-certificate-key #f))))
 
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 582cf53..8a16f50 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2016, 2017 Julien Lepiller <address@hidden>
 ;;; Copyright © 2017 Christopher Baines <address@hidden>
 ;;; Copyright © 2017 nee <address@hidden>
+;;; Copyright © 2017 Clément Lassieur <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -49,8 +50,7 @@
             <nginx-server-configuration>
             nginx-server-configuration
             nginx-server-configuration?
-            nginx-server-configuration-http-port
-            nginx-server-configuartion-https-port
+            nginx-server-configuration-listen
             nginx-server-configuration-server-name
             nginx-server-configuration-root
             nginx-server-configuration-locations
@@ -135,10 +135,8 @@
 (define-record-type* <nginx-server-configuration>
   nginx-server-configuration make-nginx-server-configuration
   nginx-server-configuration?
-  (http-port           nginx-server-configuration-http-port
-                       (default 80))
-  (https-port          nginx-server-configuration-https-port
-                       (default 443))
+  (listen              nginx-server-configuration-listen
+                       (default '("80" "443 ssl")))
   (server-name         nginx-server-configuration-server-name
                        (default (list 'default)))
   (root                nginx-server-configuration-root
@@ -225,8 +223,7 @@ of index files."
       "      }\n"))))
 
 (define (emit-nginx-server-config server)
-  (let ((http-port (nginx-server-configuration-http-port server))
-        (https-port (nginx-server-configuration-https-port server))
+  (let ((listen (nginx-server-configuration-listen server))
         (server-name (nginx-server-configuration-server-name server))
         (ssl-certificate (nginx-server-configuration-ssl-certificate server))
         (ssl-certificate-key
@@ -245,8 +242,7 @@ of index files."
             '())))
     (list
      "    server {\n"
-     (and/l http-port  "      listen " (number->string <>) ";\n")
-     (and/l https-port "      listen " (number->string <>) " ssl;\n")
+     (map (lambda (directive) (list "      listen " directive ";\n")) listen)
      "      server_name " (config-domain-strings server-name) ";\n"
      (and/l ssl-certificate     "      ssl_certificate " <> ";\n")
      (and/l ssl-certificate-key "      ssl_certificate_key " <> ";\n")
diff --git a/gnu/tests/version-control.scm b/gnu/tests/version-control.scm
index 2cbacf0..7367861 100644
--- a/gnu/tests/version-control.scm
+++ b/gnu/tests/version-control.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017 Oleg Pykhalov <address@hidden>
 ;;; Copyright © 2017 Ludovic Courtès <address@hidden>
+;;; Copyright © 2017 Clément Lassieur <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -78,8 +79,7 @@
                "fastcgi_param HTTP_HOST $server_name;"
                "fastcgi_pass 127.0.0.1:9000;")))))
     (try-files (list "$uri" "@cgit"))
-    (http-port 19418)
-    (https-port #f)
+    (listen '("19418"))
     (ssl-certificate #f)
     (ssl-certificate-key #f))))
 
@@ -211,8 +211,7 @@ HTTP-PORT."
    (server-blocks
     (list
      (nginx-server-configuration
-      (http-port 19418)
-      (https-port #f)
+      (listen '("19418"))
       (ssl-certificate #f)
       (ssl-certificate-key #f)
       (locations
diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm
index e975cb8..f1214fb 100644
--- a/gnu/tests/web.scm
+++ b/gnu/tests/web.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2017 Christopher Baines <address@hidden>
+;;; Copyright © 2017 Clément Lassieur <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -47,7 +48,7 @@
   ;; Server blocks.
   (list (nginx-server-configuration
          (root "/srv")
-         (http-port 8042))))
+         (listen '("8042" "443 ssl")))))
 
 (define %nginx-os
   ;; Operating system under test.
@@ -153,8 +154,7 @@ echo(\"Computed by php:\".((string)(2+3)));
          (root "/srv")
          (locations
           (list (nginx-php-location)))
-         (http-port 8042)
-         (https-port #f)
+         (listen "8042")
          (ssl-certificate #f)
          (ssl-certificate-key #f))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]