mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 21:59:08 -05:00
services/web: nginx-configuration: Add support for global directives.
* gnu/services/web.scm (<nginx-configuration>)[global-directives]: Add field. (emit-global-directive): New procedure. (default-nginx-config): Use it. * doc/guix.texi (Web Services): Document it.
This commit is contained in:
parent
995b391013
commit
b420e6deb9
2 changed files with 21 additions and 0 deletions
|
@ -20272,6 +20272,17 @@ names of loadable modules, as in this example:
|
||||||
/etc/nginx/modules/ngx_http_accept_language_module.so")))
|
/etc/nginx/modules/ngx_http_accept_language_module.so")))
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
|
@item @code{global-directives} (default: @code{'()})
|
||||||
|
Association list of global directives for the top level of the nginx
|
||||||
|
configuration. Values may themselves be association lists.
|
||||||
|
|
||||||
|
@lisp
|
||||||
|
(global-directives
|
||||||
|
`((worker_processes . 16)
|
||||||
|
(pcre_jit . on)
|
||||||
|
(events . ((worker_connections . 1024)))))
|
||||||
|
@end lisp
|
||||||
|
|
||||||
@item @code{extra-content} (default: @code{""})
|
@item @code{extra-content} (default: @code{""})
|
||||||
Extra content for the @code{http} block. Should be string or a string
|
Extra content for the @code{http} block. Should be string or a string
|
||||||
valued G-expression.
|
valued G-expression.
|
||||||
|
|
|
@ -529,6 +529,7 @@ (define-record-type* <nginx-configuration>
|
||||||
(server-names-hash-bucket-max-size nginx-configuration-server-names-hash-bucket-max-size
|
(server-names-hash-bucket-max-size nginx-configuration-server-names-hash-bucket-max-size
|
||||||
(default #f))
|
(default #f))
|
||||||
(modules nginx-configuration-modules (default '()))
|
(modules nginx-configuration-modules (default '()))
|
||||||
|
(global-directives nginx-configuration-global-directives (default '()))
|
||||||
(extra-content nginx-configuration-extra-content
|
(extra-content nginx-configuration-extra-content
|
||||||
(default ""))
|
(default ""))
|
||||||
(file nginx-configuration-file ;#f | string | file-like
|
(file nginx-configuration-file ;#f | string | file-like
|
||||||
|
@ -552,6 +553,13 @@ (define (config-index-strings names)
|
||||||
(define (emit-load-module module)
|
(define (emit-load-module module)
|
||||||
(list "load_module " module ";\n"))
|
(list "load_module " module ";\n"))
|
||||||
|
|
||||||
|
(define emit-global-directive
|
||||||
|
(match-lambda
|
||||||
|
((key . (? list? alist))
|
||||||
|
(format #f "~a { ~{~a~}}~%" key (map emit-global-directive alist)))
|
||||||
|
((key . value)
|
||||||
|
(format #f "~a ~a;~%" key value))))
|
||||||
|
|
||||||
(define emit-nginx-location-config
|
(define emit-nginx-location-config
|
||||||
(match-lambda
|
(match-lambda
|
||||||
(($ <nginx-location-configuration> uri body)
|
(($ <nginx-location-configuration> uri body)
|
||||||
|
@ -626,12 +634,14 @@ (define (default-nginx-config config)
|
||||||
server-names-hash-bucket-size
|
server-names-hash-bucket-size
|
||||||
server-names-hash-bucket-max-size
|
server-names-hash-bucket-max-size
|
||||||
modules
|
modules
|
||||||
|
global-directives
|
||||||
extra-content)
|
extra-content)
|
||||||
(apply mixed-text-file "nginx.conf"
|
(apply mixed-text-file "nginx.conf"
|
||||||
(flatten
|
(flatten
|
||||||
"user nginx nginx;\n"
|
"user nginx nginx;\n"
|
||||||
"pid " run-directory "/pid;\n"
|
"pid " run-directory "/pid;\n"
|
||||||
"error_log " log-directory "/error.log info;\n"
|
"error_log " log-directory "/error.log info;\n"
|
||||||
|
(map emit-global-directive global-directives)
|
||||||
(map emit-load-module modules)
|
(map emit-load-module modules)
|
||||||
"http {\n"
|
"http {\n"
|
||||||
" client_body_temp_path " run-directory "/client_body_temp;\n"
|
" client_body_temp_path " run-directory "/client_body_temp;\n"
|
||||||
|
|
Loading…
Reference in a new issue