GNU bug report logs - #33104
[PATCH] services: httpd: Allow using it with PHP.

Previous Next

Package: guix-patches;

Reported by: Florian Pelz <pelzflorian <at> pelzflorian.de>

Date: Sat, 20 Oct 2018 16:45:01 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33104 in the body.
You can then email your comments to 33104 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#33104; Package guix-patches. (Sat, 20 Oct 2018 16:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Florian Pelz <pelzflorian <at> pelzflorian.de>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 20 Oct 2018 16:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Florian Pelz <pelzflorian <at> pelzflorian.de>
To: guix-patches <at> gnu.org
Subject: [PATCH] services: httpd: Allow using it with PHP.
Date: Sat, 20 Oct 2018 18:44:03 +0200
* gnu/services/web.scm (httpd): Make existing httpd-module API public.
* doc/guix.texi (Apache HTTP Server): Document its usage with PHP-FPM.
---
 doc/guix.texi        | 31 +++++++++++++++++++++++++++++++
 gnu/services/web.scm |  5 +++++
 2 files changed, 36 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index f4f19949f..58c2cd7f5 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -50,6 +50,7 @@ Copyright @copyright{} 2018 Oleg Pykhalov@*
 Copyright @copyright{} 2018 Mike Gerwitz@*
 Copyright @copyright{} 2018 Pierre-Antoine Rouby@*
 Copyright @copyright{} 2018 Gábor Boskovits@*
+Copyright @copyright{} 2018 Florian Pelz@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -16595,6 +16596,10 @@ within the store, for example @code{(file-append mod-wsgi
 @end table
 @end deffn
 
+@defvr {Scheme Variable} %default-httpd-modules
+A default list of @code{httpd-module} objects.
+@end defvr
+
 @deffn {Data Type} httpd-config-file
 This data type represents a configuration file for the httpd service.
 
@@ -16603,6 +16608,32 @@ This data type represents a configuration file for the httpd service.
 The modules to load. Additional modules can be added here, or loaded by
 additional configuration.
 
+For example, in order to handle requests for PHP files, you can use Apache’s
+@code{mod_proxy_fcgi} module along with @code{php-fpm-service-type}:
+
+@example
+(service httpd-service-type
+         (httpd-configuration
+          (config
+           (httpd-config-file
+            (modules (cons*
+                      (httpd-module
+                       (name "proxy_module")
+                       (file "modules/mod_proxy.so"))
+                      (httpd-module
+                       (name "proxy_fcgi_module")
+                       (file "modules/mod_proxy_fcgi.so"))
+                      %default-httpd-modules))
+            (extra-config (list "\
+<FilesMatch \\.php$>
+    SetHandler \"proxy:unix:/var/run/php-fpm.sock|fcgi://localhost/\"
+</FilesMatch>"))))))
+(service php-fpm-service-type
+         (php-fpm-configuration
+          (socket "/var/run/php-fpm.sock")
+          (socket-group "httpd")))
+@end example
+
 @item @code{server-root} (default: @code{httpd})
 The @code{ServerRoot} in the configuration file, defaults to the httpd
 package. Directives including @code{Include} and @code{LoadModule} are
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 1edb1f4d3..fcf453c24 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -70,6 +70,11 @@
             httpd-config-file-user
             httpd-config-file-group
 
+            <httpd-module>
+            httpd-module
+            httpd-module?
+            %default-httpd-modules
+
             httpd-service-type
 
             <nginx-configuration>
-- 
2.19.1





Information forwarded to guix-patches <at> gnu.org:
bug#33104; Package guix-patches. (Thu, 25 Oct 2018 20:24:01 GMT) Full text and rfc822 format available.

Message #8 received at 33104 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Florian Pelz <pelzflorian <at> pelzflorian.de>,
 Christopher Baines <mail <at> cbaines.net>
Cc: 33104 <at> debbugs.gnu.org
Subject: Re: [bug#33104] [PATCH] services: httpd: Allow using it with PHP.
Date: Thu, 25 Oct 2018 22:23:07 +0200
Hi Florian!

Florian Pelz <pelzflorian <at> pelzflorian.de> skribis:

> * gnu/services/web.scm (httpd): Make existing httpd-module API public.
> * doc/guix.texi (Apache HTTP Server): Document its usage with PHP-FPM.

At first sight this LGTM but I’m no expert.  Chris, WDYT?  Please apply
if it looks good to you!

Thank you,
Ludo’.




Reply sent to Christopher Baines <mail <at> cbaines.net>:
You have taken responsibility. (Sat, 27 Oct 2018 13:17:02 GMT) Full text and rfc822 format available.

Notification sent to Florian Pelz <pelzflorian <at> pelzflorian.de>:
bug acknowledged by developer. (Sat, 27 Oct 2018 13:17:02 GMT) Full text and rfc822 format available.

Message #13 received at 33104-done <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Florian Pelz <pelzflorian <at> pelzflorian.de>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 33104-done <at> debbugs.gnu.org
Subject: Re: [bug#33104] [PATCH] services: httpd: Allow using it with PHP.
Date: Sat, 27 Oct 2018 14:16:23 +0100
[Message part 1 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi Florian!
>
> Florian Pelz <pelzflorian <at> pelzflorian.de> skribis:
>
>> * gnu/services/web.scm (httpd): Make existing httpd-module API public.
>> * doc/guix.texi (Apache HTTP Server): Document its usage with PHP-FPM.
>
> At first sight this LGTM but I’m no expert.  Chris, WDYT?  Please apply
> if it looks good to you!

Hey both,

Thanks for this patch Florian, it looks like a good change to make, and
I've now applied it.

I think when I was writing the httpd service originally, I ended up just
sticking the module loading in the extra configuration, but this looks
like a good way of handling it.

Thanks again,

Chris
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33104; Package guix-patches. (Sat, 27 Oct 2018 15:00:02 GMT) Full text and rfc822 format available.

Message #16 received at 33104 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Christopher Baines <mail <at> cbaines.net>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 33104 <at> debbugs.gnu.org
Subject: Re: [bug#33104] [PATCH] services: httpd: Allow using it with PHP.
Date: Sat, 27 Oct 2018 16:59:06 +0200
Thank you!

On Sat, Oct 27, 2018 at 02:16:23PM +0100, Christopher Baines wrote:
> I think when I was writing the httpd service originally, I ended up just
> sticking the module loading in the extra configuration, but this looks
> like a good way of handling it.
> 

Your original httpd service had a modules field, it was
already documented in the Guix manual, only the httpd-module was not
public API and the field was therefore unusable.

Regards,
Florian




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 25 Nov 2018 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 201 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.