all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oleg Pykhalov <go.wigust@gmail.com>
To: Julien Lepiller <julien@lepiller.eu>
Cc: 28560@debbugs.gnu.org
Subject: [bug#28560] [PATCH] web: Add try-files for the nginx-service-type.
Date: Thu, 28 Sep 2017 20:04:53 +0300	[thread overview]
Message-ID: <873776sqiy.fsf@gmail.com> (raw)
In-Reply-To: <67F0DB51-4862-4965-B467-DB517FB3F348@lepiller.eu> (Julien Lepiller's message of "Tue, 26 Sep 2017 09:53:52 +0200")

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

Hello Julien,

Julien Lepiller <julien@lepiller.eu> writes:

> I'm not sure about the last part of your sentence, do we explain what
> the "current context" is?

No we didn't.  And I don't see any ‘context’ mention in ‘@subsubsection
Web Services’.

> Is it even relevant?

Probably not relevant.

> Could you add a sentence to explain the usage of variables here, such
> as "$uri"? Maybe a small example would be enough.

Sure.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-web-Add-try-files-for-the-nginx-service-type.patch --]
[-- Type: text/x-patch, Size: 3170 bytes --]

From 783d1c22dfda8d1a86c0a01683ebe1278e44c3bd Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Sat, 23 Sep 2017 03:27:49 +0300
Subject: [PATCH] web: Add try-files for the nginx-service-type.

* gnu/services/web.scm (<nginx-server-configuration>): Add
  nginx-server-configuration-try-files.
(emit-nginx-server-config): Add this.
* doc/guix.texi (Web Services): Add this.
---
 doc/guix.texi        | 7 ++++++-
 gnu/services/web.scm | 6 ++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index dd0a46a63..1b329d255 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -14263,7 +14263,8 @@ blocks, as in this example:
                         (https-port #f)
                         (ssl-certificate #f)
                         (ssl-certificate-key #f)
-                        (root "/srv/http/extra-website"))))
+                        (root "/srv/http/extra-website")
+                        (try-files (list "$uri" "$uri/index.html")))))
 @end example
 @end deffn
 
@@ -14394,6 +14395,10 @@ 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 whose existence is checked in the specified order.
+@code{nginx} will use the first file it finds to process the request.
+
 @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


  reply	other threads:[~2017-09-28 17:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-23  0:38 [bug#28560] [PATCH] web: Add try-files for the nginx-service-type Oleg Pykhalov
2017-09-23 21:54 ` Oleg Pykhalov
2017-09-23 22:13   ` Oleg Pykhalov
2017-09-23 23:01     ` Oleg Pykhalov
2017-09-24 13:02       ` Julien Lepiller
2017-09-24 18:09         ` Oleg Pykhalov
2017-09-26  7:53           ` Julien Lepiller
2017-09-28 17:04             ` Oleg Pykhalov [this message]
2017-09-28 18:40               ` bug#28560: " Julien Lepiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=873776sqiy.fsf@gmail.com \
    --to=go.wigust@gmail.com \
    --cc=28560@debbugs.gnu.org \
    --cc=julien@lepiller.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.