guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] improve nginx-service


From: Ludovic Courtès
Subject: Re: [PATCH] improve nginx-service
Date: Mon, 24 Oct 2016 22:51:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Hi,

Julien Lepiller <address@hidden> skribis:

> On Wed, 19 Oct 2016 23:04:14 +0200
> address@hidden (Ludovic Courtès) wrote:
>
>> Hi Julien,
>> 
>> This looks like a great improvement to me!  Sounds nicer than fiddling
>> with config files.
>> 
>> I suppose we could make ‘nginx-service-type’ extensible (info "(guix)
>> Service Types and Services") so that people can write services that
>> define new vhosts?
>
> You mean something like udev-service-type where you could extend it
> with a list of vhosts?

Yes, exactly.  So for example one could write a service for some
high-level Web service that would in turn create an nginx vhost.
WDYT?

> From 8bda6fdd53b3cc7470fac67228a88e0d165134dd Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <address@hidden>
> Date: Mon, 26 Sep 2016 23:55:58 +0200
> Subject: [PATCH] services: improve nginx-service configuration
>
> * gnu/services/web.scm (<nginx-vhost-configuration>): New record type.
> (config-domain-strings): New procedure.
> (config-index-strings): New procedure.
> (default-nginx-vhost-config): New procedure.
> (default-nginx-config): Add vhost support and temporary directories
> (nginx-activation): Create temporary directories
> (nginx-service): Add vhost-list key.
> * doc/guix.texi (Web Services): Document 'nginx-vhost-configuration'.

Applied with the minor changes below.

Thank you!

Ludo’.

diff --git a/doc/guix.texi b/doc/guix.texi
index 646808b..1293b8b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -27,7 +27,8 @@ Copyright @copyright{} 2016 Chris address@hidden
 Copyright @copyright{} 2016 Efraim address@hidden
 Copyright @copyright{} 2016 John address@hidden
 Copyright @copyright{} 2016 address@hidden
-Copyright @copyright{} 2016 Jan Nieuwenhuizen
+Copyright @copyright{} 2016 Jan address@hidden
+Copyright @copyright{} 2016 Julien Lepiller
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -10417,6 +10418,7 @@ this to work, use the default value for 
@var{config-file}.
 @deftp {Data Type} nginx-vhost-configuration
 Data type representing the configuration of an nginx virtual host.
 This type has the following parameters:
+
 @table @asis
 @item @code{http-port} (default: @code{80})
 Nginx will listen for HTTP connection on this port.  Set it at @code{#f} if
@@ -10434,18 +10436,18 @@ Note that nginx can listen for HTTP and HTTPS 
connections in the same
 A list of server names this vhost represents. @code{'default} represents the
 default vhost for connections matching no other vhost.
 
address@hidden @code{root} (default: @code{``/srv/http''})
address@hidden @code{root} (default: @code{"/srv/http"})
 Root of the website nginx will serve.
 
address@hidden @code{index} (default: @code{(list ``index.html'')})
address@hidden @code{index} (default: @code{(list "index.html")})
 Index files to look for when clients ask for a directory.  If it cannot be 
found,
 Nginx will send the list of files in the directory.
 
address@hidden @code{ssl-certificate} (default: @code{``/etc/nginx/cert.pem''})
address@hidden @code{ssl-certificate} (default: @code{"/etc/nginx/cert.pem"})
 Where to find the certificate for secure connections.  Set it to @code{#f} if
 you don't have a certificate or you don't want to use HTTPS.
 
address@hidden @code{ssl-certificate-key} (default: 
@code{``/etc/nginx/key.pem''})
address@hidden @code{ssl-certificate-key} (default: @code{"/etc/nginx/key.pem"})
 Where to find the private key for secure connections.  Set it to @code{#f} if
 you don't have a key or you don't want to use HTTPS.
 
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 49a2962..59e1e54 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -87,7 +87,7 @@ of index files."
        names)))
 
 (define (default-nginx-vhost-config vhost)
-  (string-append 
+  (string-append
    "    server {\n"
    (if (nginx-vhost-configuration-http-port vhost)
        (string-append "      listen "
@@ -130,9 +130,9 @@ of index files."
                "    scgi_temp_path " run-directory "/scgi_temp;\n"
                "    access_log " log-directory "/access.log;\n"
                (let ((http (map default-nginx-vhost-config vhost-list)))
-                    (do ((http http (cdr http)) 
-                         (block "" (string-append (car http) "\n" block )))
-                        ((null? http) block)))
+                 (do ((http http (cdr http))
+                      (block "" (string-append (car http) "\n" block )))
+                     ((null? http) block)))
                "}\n"
                "events {}\n")))
 

reply via email to

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