From: reyk Date: Fri, 25 Jul 2014 17:49:11 +0000 (+0000) Subject: Add multiple-servers "virtual hosts" example. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c0621b90bcb59c40f83cead7ef6f9bf2071ba2e7;p=openbsd Add multiple-servers "virtual hosts" example. --- diff --git a/usr.sbin/httpd/httpd.conf.5 b/usr.sbin/httpd/httpd.conf.5 index cbd10048f29..2cb442f2c86 100644 --- a/usr.sbin/httpd/httpd.conf.5 +++ b/usr.sbin/httpd/httpd.conf.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: httpd.conf.5,v 1.6 2014/07/25 15:47:11 reyk Exp $ +.\" $OpenBSD: httpd.conf.5,v 1.7 2014/07/25 17:49:11 reyk Exp $ .\" .\" Copyright (c) 2014 Reyk Floeter .\" @@ -160,9 +160,9 @@ to the specified extension One or more names can be specified per line. .El .Sh EXAMPLES -The following example will start two pre-forked servers that are -listening on the primary IP address of the network interface that is a -member of the +The following example will start one server that is pre-forked two +times and listening on the primary IP address of the network interface +that is a member of the .Ar egress group. It additionally defines some media types overriding the defaults. @@ -185,6 +185,28 @@ types { } .Ed .Pp +Multiple servers can be configured to support hosting of different domains. +If the same address is repeated multiple times in the +.Ic listen on +statement, +the server will be matched based on the requested host name. +.Bd -literal -offset indent +server "www.a.example.com" { + listen on 203.0.113.1 port 80 + root "/htdocs/www.a.example.com" +} + +server "www.b.example.com" { + listen on 203.0.113.1 port 80 + root "/htdocs/www.b.example.com" +} + +server "intranet.example.com" { + listen on 10.0.0.1 port 80 + root "/htdocs/intranet.example.com" +} +.Ed +.Pp The syntax of the types section is compatible with the format used by .Xr nginx 8 , so it is possible to include its