aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Pelz <pelzflorian@pelzflorian.de>2018-10-20 18:44:03 +0200
committerChristopher Baines <mail@cbaines.net>2018-10-27 14:08:45 +0100
commitabc98e3be5fbccf88fe69399db4d83f902b65a15 (patch)
tree519b98d91531c596612d966507e48affd507d770
parentcbea1e8dd22c01b8c228afc0b74dfe39ed356d37 (diff)
downloadpatches-abc98e3be5fbccf88fe69399db4d83f902b65a15.tar
patches-abc98e3be5fbccf88fe69399db4d83f902b65a15.tar.gz
services: httpd: Allow using it with PHP.
* gnu/services/web.scm (httpd): Make existing httpd-module API public. * doc/guix.texi (Apache HTTP Server): Document its usage with PHP-FPM. Signed-off-by: Christopher Baines <mail@cbaines.net>
-rw-r--r--doc/guix.texi31
-rw-r--r--gnu/services/web.scm5
2 files changed, 36 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 12346c4b8e..87579d414d 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
@@ -16612,6 +16613,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.
@@ -16620,6 +16625,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 1edb1f4d34..fcf453c248 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>