services: nginx: Rename "vhost" to "server".
* gnu/services/web.scm (<nginx-vhost-configuration>): Rename to... (<nginx-server-configuration>): ... this. * doc/guix.texi (Web Services): Adjust accordingly. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
7b030c9f9b
commit
3b9b12ef49
|
@ -11827,7 +11827,7 @@ The @code{(gnu services web)} module provides the following service:
|
||||||
@deffn {Scheme Procedure} nginx-service [#:nginx nginx] @
|
@deffn {Scheme Procedure} nginx-service [#:nginx nginx] @
|
||||||
[#:log-directory ``/var/log/nginx''] @
|
[#:log-directory ``/var/log/nginx''] @
|
||||||
[#:run-directory ``/var/run/nginx''] @
|
[#:run-directory ``/var/run/nginx''] @
|
||||||
[#:vhost-list (list (nginx-vhost-configuration))] @
|
[#:server-list (list (nginx-server-configuration))] @
|
||||||
[#:config-file]
|
[#:config-file]
|
||||||
|
|
||||||
Return a service that runs @var{nginx}, the nginx web server.
|
Return a service that runs @var{nginx}, the nginx web server.
|
||||||
|
@ -11838,32 +11838,32 @@ files are written to @var{run-directory}. For proper operation, these
|
||||||
arguments should match what is in @var{config-file} to ensure that the
|
arguments should match what is in @var{config-file} to ensure that the
|
||||||
directories are created when the service is activated.
|
directories are created when the service is activated.
|
||||||
|
|
||||||
As an alternative to using a @var{config-file}, @var{vhost-list} can be
|
As an alternative to using a @var{config-file}, @var{server-list} can be
|
||||||
used to specify the list of @dfn{virtual hosts} required on the host. For
|
used to specify the list of @dfn{server blocks} required on the host. For
|
||||||
this to work, use the default value for @var{config-file}.
|
this to work, use the default value for @var{config-file}.
|
||||||
|
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deftp {Data Type} nginx-vhost-configuration
|
@deftp {Data Type} nginx-server-configuration
|
||||||
Data type representing the configuration of an nginx virtual host.
|
Data type representing the configuration of an nginx server block.
|
||||||
This type has the following parameters:
|
This type has the following parameters:
|
||||||
|
|
||||||
@table @asis
|
@table @asis
|
||||||
@item @code{http-port} (default: @code{80})
|
@item @code{http-port} (default: @code{80})
|
||||||
Nginx will listen for HTTP connection on this port. Set it at @code{#f} if
|
Nginx will listen for HTTP connection on this port. Set it at @code{#f} if
|
||||||
nginx should not listen for HTTP (non secure) connection for this
|
nginx should not listen for HTTP (non secure) connection for this
|
||||||
@dfn{virtual host}.
|
@dfn{server block}.
|
||||||
|
|
||||||
@item @code{https-port} (default: @code{443})
|
@item @code{https-port} (default: @code{443})
|
||||||
Nginx will listen for HTTPS connection on this port. Set it at @code{#f} if
|
Nginx will listen for HTTPS connection on this port. Set it at @code{#f} if
|
||||||
nginx should not listen for HTTPS (secure) connection for this @dfn{virtual host}.
|
nginx should not listen for HTTPS (secure) connection for this @dfn{server block}.
|
||||||
|
|
||||||
Note that nginx can listen for HTTP and HTTPS connections in the same
|
Note that nginx can listen for HTTP and HTTPS connections in the same
|
||||||
@dfn{virtual host}.
|
@dfn{server block}.
|
||||||
|
|
||||||
@item @code{server-name} (default: @code{(list 'default)})
|
@item @code{server-name} (default: @code{(list 'default)})
|
||||||
A list of server names this vhost represents. @code{'default} represents the
|
A list of server names this server represents. @code{'default} represents the
|
||||||
default vhost for connections matching no other vhost.
|
default server for connections matching no other server.
|
||||||
|
|
||||||
@item @code{root} (default: @code{"/srv/http"})
|
@item @code{root} (default: @code{"/srv/http"})
|
||||||
Root of the website nginx will serve.
|
Root of the website nginx will serve.
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:export (nginx-configuration
|
#:export (nginx-configuration
|
||||||
nginx-configuration?
|
nginx-configuration?
|
||||||
nginx-vhost-configuration
|
nginx-server-configuration
|
||||||
nginx-vhost-configuration?
|
nginx-server-configuration?
|
||||||
nginx-service
|
nginx-service
|
||||||
nginx-service-type))
|
nginx-service-type))
|
||||||
|
|
||||||
|
@ -41,24 +41,24 @@
|
||||||
;;;
|
;;;
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(define-record-type* <nginx-vhost-configuration>
|
(define-record-type* <nginx-server-configuration>
|
||||||
nginx-vhost-configuration make-nginx-vhost-configuration
|
nginx-server-configuration make-nginx-server-configuration
|
||||||
nginx-vhost-configuration?
|
nginx-server-configuration?
|
||||||
(http-port nginx-vhost-configuration-http-port
|
(http-port nginx-server-configuration-http-port
|
||||||
(default 80))
|
(default 80))
|
||||||
(https-port nginx-vhost-configuration-https-port
|
(https-port nginx-server-configuration-https-port
|
||||||
(default 443))
|
(default 443))
|
||||||
(server-name nginx-vhost-configuration-server-name
|
(server-name nginx-server-configuration-server-name
|
||||||
(default (list 'default)))
|
(default (list 'default)))
|
||||||
(root nginx-vhost-configuration-root
|
(root nginx-server-configuration-root
|
||||||
(default "/srv/http"))
|
(default "/srv/http"))
|
||||||
(index nginx-vhost-configuration-index
|
(index nginx-server-configuration-index
|
||||||
(default (list "index.html")))
|
(default (list "index.html")))
|
||||||
(ssl-certificate nginx-vhost-configuration-ssl-certificate
|
(ssl-certificate nginx-server-configuration-ssl-certificate
|
||||||
(default "/etc/nginx/cert.pem"))
|
(default "/etc/nginx/cert.pem"))
|
||||||
(ssl-certificate-key nginx-vhost-configuration-ssl-certificate-key
|
(ssl-certificate-key nginx-server-configuration-ssl-certificate-key
|
||||||
(default "/etc/nginx/key.pem"))
|
(default "/etc/nginx/key.pem"))
|
||||||
(server-tokens? nginx-vhost-configuration-server-tokens?
|
(server-tokens? nginx-server-configuration-server-tokens?
|
||||||
(default #f)))
|
(default #f)))
|
||||||
|
|
||||||
(define-record-type* <nginx-configuration>
|
(define-record-type* <nginx-configuration>
|
||||||
|
@ -86,37 +86,37 @@ of index files."
|
||||||
((? string? str) str))
|
((? string? str) str))
|
||||||
names)))
|
names)))
|
||||||
|
|
||||||
(define (default-nginx-vhost-config vhost)
|
(define (default-nginx-server-config server)
|
||||||
(string-append
|
(string-append
|
||||||
" server {\n"
|
" server {\n"
|
||||||
(if (nginx-vhost-configuration-http-port vhost)
|
(if (nginx-server-configuration-http-port server)
|
||||||
(string-append " listen "
|
(string-append " listen "
|
||||||
(number->string (nginx-vhost-configuration-http-port vhost))
|
(number->string (nginx-server-configuration-http-port server))
|
||||||
";\n")
|
";\n")
|
||||||
"")
|
"")
|
||||||
(if (nginx-vhost-configuration-https-port vhost)
|
(if (nginx-server-configuration-https-port server)
|
||||||
(string-append " listen "
|
(string-append " listen "
|
||||||
(number->string (nginx-vhost-configuration-https-port vhost))
|
(number->string (nginx-server-configuration-https-port server))
|
||||||
" ssl;\n")
|
" ssl;\n")
|
||||||
"")
|
"")
|
||||||
" server_name " (config-domain-strings
|
" server_name " (config-domain-strings
|
||||||
(nginx-vhost-configuration-server-name vhost))
|
(nginx-server-configuration-server-name server))
|
||||||
";\n"
|
";\n"
|
||||||
(if (nginx-vhost-configuration-ssl-certificate vhost)
|
(if (nginx-server-configuration-ssl-certificate server)
|
||||||
(string-append " ssl_certificate "
|
(string-append " ssl_certificate "
|
||||||
(nginx-vhost-configuration-ssl-certificate vhost) ";\n")
|
(nginx-server-configuration-ssl-certificate server) ";\n")
|
||||||
"")
|
"")
|
||||||
(if (nginx-vhost-configuration-ssl-certificate-key vhost)
|
(if (nginx-server-configuration-ssl-certificate-key server)
|
||||||
(string-append " ssl_certificate_key "
|
(string-append " ssl_certificate_key "
|
||||||
(nginx-vhost-configuration-ssl-certificate-key vhost) ";\n")
|
(nginx-server-configuration-ssl-certificate-key server) ";\n")
|
||||||
"")
|
"")
|
||||||
" root " (nginx-vhost-configuration-root vhost) ";\n"
|
" root " (nginx-server-configuration-root server) ";\n"
|
||||||
" index " (config-index-strings (nginx-vhost-configuration-index vhost)) ";\n"
|
" index " (config-index-strings (nginx-server-configuration-index server)) ";\n"
|
||||||
" server_tokens " (if (nginx-vhost-configuration-server-tokens? vhost)
|
" server_tokens " (if (nginx-server-configuration-server-tokens? server)
|
||||||
"on" "off") ";\n"
|
"on" "off") ";\n"
|
||||||
" }\n"))
|
" }\n"))
|
||||||
|
|
||||||
(define (default-nginx-config log-directory run-directory vhost-list)
|
(define (default-nginx-config log-directory run-directory server-list)
|
||||||
(plain-file "nginx.conf"
|
(plain-file "nginx.conf"
|
||||||
(string-append
|
(string-append
|
||||||
"user nginx nginx;\n"
|
"user nginx nginx;\n"
|
||||||
|
@ -129,7 +129,7 @@ of index files."
|
||||||
" uwsgi_temp_path " run-directory "/uwsgi_temp;\n"
|
" uwsgi_temp_path " run-directory "/uwsgi_temp;\n"
|
||||||
" scgi_temp_path " run-directory "/scgi_temp;\n"
|
" scgi_temp_path " run-directory "/scgi_temp;\n"
|
||||||
" access_log " log-directory "/access.log;\n"
|
" access_log " log-directory "/access.log;\n"
|
||||||
(let ((http (map default-nginx-vhost-config vhost-list)))
|
(let ((http (map default-nginx-server-config server-list)))
|
||||||
(do ((http http (cdr http))
|
(do ((http http (cdr http))
|
||||||
(block "" (string-append (car http) "\n" block )))
|
(block "" (string-append (car http) "\n" block )))
|
||||||
((null? http) block)))
|
((null? http) block)))
|
||||||
|
@ -197,9 +197,9 @@ of index files."
|
||||||
(define* (nginx-service #:key (nginx nginx)
|
(define* (nginx-service #:key (nginx nginx)
|
||||||
(log-directory "/var/log/nginx")
|
(log-directory "/var/log/nginx")
|
||||||
(run-directory "/var/run/nginx")
|
(run-directory "/var/run/nginx")
|
||||||
(vhost-list (list (nginx-vhost-configuration)))
|
(server-list (list (nginx-server-configuration)))
|
||||||
(config-file
|
(config-file
|
||||||
(default-nginx-config log-directory run-directory vhost-list)))
|
(default-nginx-config log-directory run-directory server-list)))
|
||||||
"Return a service that runs NGINX, the nginx web server.
|
"Return a service that runs NGINX, the nginx web server.
|
||||||
|
|
||||||
The nginx daemon loads its runtime configuration from CONFIG-FILE, stores log
|
The nginx daemon loads its runtime configuration from CONFIG-FILE, stores log
|
||||||
|
|
Loading…
Reference in New Issue