-.\" $OpenBSD: httpd.conf.5,v 1.5 2014/07/22 19:03:21 jmc Exp $
+.\" $OpenBSD: httpd.conf.5,v 1.6 2014/07/25 15:47:11 reyk Exp $
.\"
.\" Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: July 22 2014 $
+.Dd $Mdocdate: July 25 2014 $
.Dt HTTPD.CONF 5
.Os
.Sh NAME
.Bl -tag -width Ds
.It Ic listen on Ar address Ic port Ar number
Set the listen address and port.
+.It Ic root Ar directory
+Set the document root of the server.
+The
+.Ar directory
+is a pathname within the
+.Xr chroot 2
+root directory of
+.Nm httpd .
+If not specified, it defaults to
+.Pa /htdocs .
.El
.Sh TYPES
Configure the supported media types.
-/* $OpenBSD: parse.y,v 1.4 2014/07/25 12:42:05 reyk Exp $ */
+/* $OpenBSD: parse.y,v 1.5 2014/07/25 15:47:11 reyk Exp $ */
/*
* Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org>
%}
-%token ALL PORT LISTEN PREFORK SERVER ERROR INCLUDE LOG VERBOSE ON TYPES
+%token ALL PORT LISTEN PREFORK ROOT SERVER ERROR LOG VERBOSE ON TYPES
%token UPDATES INCLUDE
%token <v.string> STRING
%token <v.number> NUMBER
s->srv_conf.port = h->port.val[0];
host_free(&al);
}
+ | ROOT STRING {
+ if (strlcpy(srv->srv_conf.docroot, $2,
+ sizeof(srv->srv_conf.docroot)) >=
+ sizeof(srv->srv_conf.docroot)) {
+ yyerror("document root too long");
+ free($2);
+ YYERROR;
+ }
+ free($2);
+ }
;
types : TYPES '{' optnl mediaopts_l '}'
{ "on", ON },
{ "port", PORT },
{ "prefork", PREFORK },
+ { "root", ROOT },
{ "server", SERVER },
{ "types", TYPES },
{ "updates", UPDATES }