From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] improve nginx-service Date: Mon, 24 Oct 2016 22:51:27 +0200 Message-ID: <87shrlzd0w.fsf@gnu.org> References: <20161016143347.38d8a6f2@polymos.lepiller.eu> <874m483vap.fsf@gnu.org> <20161020143744.516a1184@polymos.lepiller.eu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55910) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bymDV-0000Sp-Ho for guix-devel@gnu.org; Mon, 24 Oct 2016 16:51:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bymDS-0000bq-DZ for guix-devel@gnu.org; Mon, 24 Oct 2016 16:51:33 -0400 In-Reply-To: <20161020143744.516a1184@polymos.lepiller.eu> (Julien Lepiller's message of "Thu, 20 Oct 2016 14:37:44 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Julien Lepiller Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Julien Lepiller skribis: > On Wed, 19 Oct 2016 23:04:14 +0200 > ludo@gnu.org (Ludovic Court=C3=A8s) wrote: > >> Hi Julien, >>=20 >> This looks like a great improvement to me! Sounds nicer than fiddling >> with config files. >>=20 >> I suppose we could make =E2=80=98nginx-service-type=E2=80=99 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 > Date: Mon, 26 Sep 2016 23:55:58 +0200 > Subject: [PATCH] services: improve nginx-service configuration > > * gnu/services/web.scm (): 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=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline 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 Marusich@* Copyright @copyright{} 2016 Efraim Flashner@* Copyright @copyright{} 2016 John Darrington@* Copyright @copyright{} 2016 ng0@* -Copyright @copyright{} 2016 Jan Nieuwenhuizen +Copyright @copyright{} 2016 Jan Nieuwenhuizen@* +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. -@item @code{root} (default: @code{``/srv/http''}) +@item @code{root} (default: @code{"/srv/http"}) Root of the website nginx will serve. -@item @code{index} (default: @code{(list ``index.html'')}) +@item @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. -@item @code{ssl-certificate} (default: @code{``/etc/nginx/cert.pem''}) +@item @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. -@item @code{ssl-certificate-key} (default: @code{``/etc/nginx/key.pem''}) +@item @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"))) --=-=-=--