From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwBLy-0005Y4-Ce for guix-patches@gnu.org; Sun, 24 Sep 2017 14:10:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwBLv-0005ct-43 for guix-patches@gnu.org; Sun, 24 Sep 2017 14:10:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:47758) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dwBLu-0005cn-W9 for guix-patches@gnu.org; Sun, 24 Sep 2017 14:10:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dwBLu-000805-L4 for guix-patches@gnu.org; Sun, 24 Sep 2017 14:10:02 -0400 Subject: [bug#28560] [PATCH] web: Add try-files for the nginx-service-type. Resent-Message-ID: From: Oleg Pykhalov References: <874lruckq8.fsf@gmail.com> <87k20prshw.fsf@gmail.com> <87h8vtrrlz.fsf@gmail.com> <87d16hrpdq.fsf@gmail.com> <72986E30-EF66-44C3-AAEC-718F0CAD19D4@lepiller.eu> Date: Sun, 24 Sep 2017 21:09:26 +0300 In-Reply-To: <72986E30-EF66-44C3-AAEC-718F0CAD19D4@lepiller.eu> (Julien Lepiller's message of "Sun, 24 Sep 2017 15:02:43 +0200") Message-ID: <87fubcynmx.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Julien Lepiller Cc: 28560@debbugs.gnu.org --=-=-= Content-Type: text/plain Hello Julien, Julien Lepiller writes: > Thank you for the patch! I think it will be perfect after you update doc/guix.texi too. Thank you for review. I rephrase little bit https://nginx.org/en/docs/http/ngx_http_core_module.html#try_files Here is a new patch. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-web-Add-try-files-for-the-nginx-service-type.patch >From fa5c4df154da2029d1f909c51b742377f55d732e Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Sat, 23 Sep 2017 03:27:49 +0300 Subject: [PATCH] web: Add try-files for the nginx-service-type. * gnu/services/web.scm (): Add nginx-server-configuration-try-files. (emit-nginx-server-config): Add this. * doc/guix.texi (Web Services): Add this. --- doc/guix.texi | 5 +++++ gnu/services/web.scm | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 0462a6419..e60ddafde 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -14344,6 +14344,11 @@ server block. 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{try-files} (default: @code{'()}) +A list of files to check their existence in the specified order and uses +the first found file for request processing; the processing is performed +in the current context. + @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. diff --git a/gnu/services/web.scm b/gnu/services/web.scm index 4aa6fd501..9d713003c 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -99,6 +99,8 @@ (default '())) (index nginx-server-configuration-index (default (list "index.html"))) + (try-files nginx-server-configuration-try-files + (default '())) (ssl-certificate nginx-server-configuration-ssl-certificate (default "/etc/nginx/cert.pem")) (ssl-certificate-key nginx-server-configuration-ssl-certificate-key @@ -179,6 +181,7 @@ of index files." (nginx-server-configuration-ssl-certificate-key server)) (root (nginx-server-configuration-root server)) (index (nginx-server-configuration-index server)) + (try-files (nginx-server-configuration-try-files server)) (server-tokens? (nginx-server-configuration-server-tokens? server)) (locations (nginx-server-configuration-locations server))) (define-syntax-parameter <> (syntax-rules ())) @@ -207,6 +210,9 @@ of index files." (and/l ssl-certificate-key " ssl_certificate_key " <> ";\n") " root " root ";\n" " index " (config-index-strings index) ";\n" + (if (not (nil? try-files)) + (and/l (config-index-strings try-files) " try_files " <> ";\n") + "") " server_tokens " (if server-tokens? "on" "off") ";\n" "\n" (map emit-nginx-location-config locations) -- 2.14.1 --=-=-=--