* [bug#33104] [PATCH] services: httpd: Allow using it with PHP.
@ 2018-10-20 16:44 Florian Pelz
2018-10-25 20:23 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Florian Pelz @ 2018-10-20 16:44 UTC (permalink / raw)
To: 33104
* 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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [bug#33104] [PATCH] services: httpd: Allow using it with PHP.
2018-10-20 16:44 [bug#33104] [PATCH] services: httpd: Allow using it with PHP Florian Pelz
@ 2018-10-25 20:23 ` Ludovic Courtès
2018-10-27 13:16 ` bug#33104: " Christopher Baines
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2018-10-25 20:23 UTC (permalink / raw)
To: Florian Pelz, Christopher Baines; +Cc: 33104
Hi Florian!
Florian Pelz <pelzflorian@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’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#33104: [PATCH] services: httpd: Allow using it with PHP.
2018-10-25 20:23 ` Ludovic Courtès
@ 2018-10-27 13:16 ` Christopher Baines
2018-10-27 14:59 ` [bug#33104] " pelzflorian (Florian Pelz)
0 siblings, 1 reply; 4+ messages in thread
From: Christopher Baines @ 2018-10-27 13:16 UTC (permalink / raw)
To: Florian Pelz; +Cc: 33104-done
[-- Attachment #1: Type: text/plain, Size: 695 bytes --]
Ludovic Courtès <ludo@gnu.org> writes:
> Hi Florian!
>
> Florian Pelz <pelzflorian@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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [bug#33104] [PATCH] services: httpd: Allow using it with PHP.
2018-10-27 13:16 ` bug#33104: " Christopher Baines
@ 2018-10-27 14:59 ` pelzflorian (Florian Pelz)
0 siblings, 0 replies; 4+ messages in thread
From: pelzflorian (Florian Pelz) @ 2018-10-27 14:59 UTC (permalink / raw)
To: Christopher Baines; +Cc: 33104
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-10-27 15:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-20 16:44 [bug#33104] [PATCH] services: httpd: Allow using it with PHP Florian Pelz
2018-10-25 20:23 ` Ludovic Courtès
2018-10-27 13:16 ` bug#33104: " Christopher Baines
2018-10-27 14:59 ` [bug#33104] " pelzflorian (Florian Pelz)
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).