From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvsgY-0000jM-EG for guix-patches@gnu.org; Sat, 23 Sep 2017 18:14:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dvsgV-0001kY-7r for guix-patches@gnu.org; Sat, 23 Sep 2017 18:14:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:46313) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dvsgV-0001kJ-24 for guix-patches@gnu.org; Sat, 23 Sep 2017 18:14:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dvsgU-0001AZ-73 for guix-patches@gnu.org; Sat, 23 Sep 2017 18:14: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> Date: Sun, 24 Sep 2017 01:13:12 +0300 In-Reply-To: <87k20prshw.fsf@gmail.com> (Oleg Pykhalov's message of "Sun, 24 Sep 2017 00:54:03 +0300") Message-ID: <87h8vtrrlz.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: 28560@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable OK, I hacked little bit. Here is a snippet of Nginx service in system declaration and produced Nginx config from system build. --8<---------------cut here---------------start------------->8--- (define %cgit-configuration-nginx (list (nginx-server-configuration (root cgit) (locations (list (nginx-location-configuration (uri "@cgit") (body '("fastcgi_param SCRIPT_FILENAME $document_root/lib/cgit/cgit.= cgi;" "fastcgi_param PATH_INFO $uri;" "fastcgi_param QUERY_STRING $args;" "fastcgi_param HTTP_HOST $server_name;" "fastcgi_pass 127.0.0.1:9000;"))))) (try-files (list "$uri" "@cgit")) (http-port 19418) (https-port #f) (ssl-certificate #f) (ssl-certificate-key #f)))) (operating-system =E2=80=A6 (services (cons* =E2=80=A6 (service nginx-service-type) (service fcgiwrap-service-type) (service cgit-service-type (cgit-configuration (nginx %cgit-configuration-nginx))) =E2=80=A6))) --8<---------------cut here---------------end--------------->8--- /gnu/store/pv4kna4526cijzpd6my69ikdb5qzb93m-nginx.conf --8<---------------cut here---------------start------------->8--- user nginx nginx; pid /var/run/nginx/pid; error_log /var/log/nginx/error.log info; http { client_body_temp_path /var/run/nginx/client_body_temp; proxy_temp_path /var/run/nginx/proxy_temp; fastcgi_temp_path /var/run/nginx/fastcgi_temp; uwsgi_temp_path /var/run/nginx/uwsgi_temp; scgi_temp_path /var/run/nginx/scgi_temp; access_log /var/log/nginx/access.log; include /gnu/store/vyj2vkmdmlpxn3mnj71vz8zc8j30ahkf-nginx-1.12.1/share/= nginx/conf/mime.types; server { listen 19418; server_name _ ; root /gnu/store/b4zg0sz6z1n32qnwmgmbbwh78i55hr56-cgit-1.1; index index.html ; try_files $uri @cgit ; server_tokens off; location @cgit { fastcgi_param SCRIPT_FILENAME $document_root/lib/cgit/cgit.cgi; fastcgi_param PATH_INFO $uri; fastcgi_param QUERY_STRING $args; fastcgi_param HTTP_HOST $server_name; fastcgi_pass 127.0.0.1:9000; } } } events {} --8<---------------cut here---------------end--------------->8--- --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-web-Add-try-files-for-the-nginx-service-type.patch >From 7177bc6e80c47e728486b4d5e7d61e926f17851a 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. --- gnu/services/web.scm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gnu/services/web.scm b/gnu/services/web.scm index 4aa6fd501..aec778801 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,7 @@ of index files." (and/l ssl-certificate-key " ssl_certificate_key " <> ";\n") " root " root ";\n" " index " (config-index-strings index) ";\n" + (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 --=-=-=--