431 lines
7.7 KiB
HTML
431 lines
7.7 KiB
HTML
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Configuration File</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.63
|
|
"><LINK
|
|
REL="HOME"
|
|
TITLE="PHHTTPD HTTP Accelerator HOWTO"
|
|
HREF="index.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Introduction"
|
|
HREF="introduction.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="Logging"
|
|
HREF="logging.html"></HEAD
|
|
><BODY
|
|
CLASS="SECT1"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>PHHTTPD HTTP Accelerator HOWTO</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="introduction.html"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
></TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="logging.html"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="SECT1"
|
|
><H1
|
|
CLASS="SECT1"
|
|
><A
|
|
NAME="CONFIGURATION"
|
|
>3. Configuration File</A
|
|
></H1
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN49"
|
|
>3.1. Overview</A
|
|
></H2
|
|
><P
|
|
>phhttpd uses an XML config file format to express how it should behave
|
|
while running. More information on XML may be found near
|
|
<A
|
|
HREF="http://www.w3.org/XML/"
|
|
TARGET="_top"
|
|
>http://www.w3.org/XML/</A
|
|
></P
|
|
><P
|
|
>phhttpd's configuration centers around the concept of virtual servers.
|
|
For us, a virtual server may be thought of as the merging of a document
|
|
tree and the actions phhttpd takes while serving that content. </P
|
|
><P
|
|
>phhttpd.conf may be thought of as having two main sections.
|
|
The global section, which defines properties that are consistent
|
|
across the entire running phhttpd server, and multiple virtual sections
|
|
that describe properties of that only apply to a virtual server.
|
|
There will only be one global section while multiple virtual sections
|
|
are allowed.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN55"
|
|
>3.2. Global Config Section</A
|
|
></H2
|
|
><P
|
|
>The global section defines properties of the running server that don't
|
|
apply to a single virtual server. It should be enclosed in </P
|
|
><P
|
|
><P
|
|
></P
|
|
><DIV
|
|
CLASS="VARIABLELIST"
|
|
><P
|
|
><B
|
|
>Global config entities</B
|
|
></P
|
|
><DL
|
|
><DT
|
|
><TT
|
|
CLASS="SGMLTAG"
|
|
>cache max=NUM</TT
|
|
></DT
|
|
><DD
|
|
><P
|
|
>Sets the maximum number of cached responses that will be held in memory. Each
|
|
cached responses holds a minimal amount of memory. More importantly, each
|
|
cached response holds an open file descriptor to the file with real content and
|
|
|
|
an <TT
|
|
CLASS="FUNCTION"
|
|
>mmap()</TT
|
|
>ed region of that content. phhttpd will start pruning the cache when
|
|
|
|
it notices either of these two resources coming under pressure, but has no way
|
|
|
|
to easily deduce that its running low on memory. The administrator may set this
|
|
|
|
value to set an upper bound on the number of responses to keep in memory. </P
|
|
></DD
|
|
><DT
|
|
><TT
|
|
CLASS="SGMLTAG"
|
|
> control file=PATH </TT
|
|
></DT
|
|
><DD
|
|
><P
|
|
> This specifies the file that will be used to talk with <B
|
|
CLASS="COMMAND"
|
|
>phhttpd_ctl</B
|
|
>. </P
|
|
></DD
|
|
><DT
|
|
><TT
|
|
CLASS="SGMLTAG"
|
|
> globallog file=PATH </TT
|
|
></DT
|
|
><DD
|
|
><P
|
|
> This specifies the file to which global messages will be logged. </P
|
|
></DD
|
|
><DT
|
|
><TT
|
|
CLASS="SGMLTAG"
|
|
> mime file=PATH </TT
|
|
></DT
|
|
><DD
|
|
><P
|
|
> This specifies the file that contains the mapping of file extensions to <SPAN
|
|
CLASS="ACRONYM"
|
|
>MIME</SPAN
|
|
> types. It should be of the form:
|
|
|
|
<TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="90%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
> text/sgml sgml sgm
|
|
|
|
video/mpeg mpeg mpg mpe</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
> </P
|
|
></DD
|
|
><DT
|
|
><TT
|
|
CLASS="SGMLTAG"
|
|
> timeout inactivity=NUM </TT
|
|
></DT
|
|
><DD
|
|
><P
|
|
> Controls various network connection timeouts. 'inactivity' sets the amount
|
|
|
|
of time that a connection can be idle before phhttpd will forcibly disconnect it.
|
|
|
|
inactivity defaults to 0, which lets the connections idle until TCP timeouts
|
|
|
|
take effect. </P
|
|
></DD
|
|
><DT
|
|
><TT
|
|
CLASS="SGMLTAG"
|
|
> sendfile </TT
|
|
></DT
|
|
><DD
|
|
><P
|
|
> Enabling this option tells phhttpd to use <TT
|
|
CLASS="FUNCTION"
|
|
>sendfile()</TT
|
|
> rather than
|
|
|
|
<TT
|
|
CLASS="FUNCTION"
|
|
>write()</TT
|
|
>ing from an <TT
|
|
CLASS="FUNCTION"
|
|
>mmap()</TT
|
|
>ed region.
|
|
|
|
Avoiding calling <TT
|
|
CLASS="FUNCTION"
|
|
>mmap()</TT
|
|
> will
|
|
|
|
shorten the amount of time it takes to build cached responses. </P
|
|
></DD
|
|
></DL
|
|
></DIV
|
|
> </P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN99"
|
|
>3.3. Virtual Servers</A
|
|
></H2
|
|
><P
|
|
>A Virtual Server can be thought of as the abstraction serving up a content tree
|
|
|
|
( <SPAN
|
|
CLASS="QUOTE"
|
|
>"docroot"</SPAN
|
|
> in <B
|
|
CLASS="COMMAND"
|
|
>Apache</B
|
|
> speak). There are a set of attributes
|
|
|
|
that are used to define a virtual server. These attributes are used to decide which
|
|
|
|
virtual server will process a client's request. Then there are attributes which define
|
|
|
|
how the content is served.</P
|
|
><P
|
|
> A virtual server must have a docroot. The virtual tag in the config
|
|
|
|
file has a docroot attribute that must be set.</P
|
|
><P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
><virtual docroot=PATH>
|
|
|
|
...
|
|
|
|
</virtual> </PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
|
|
There can be as many virtual sections in the configuration file as one likes. </P
|
|
><P
|
|
> <P
|
|
></P
|
|
><DIV
|
|
CLASS="VARIABLELIST"
|
|
><P
|
|
><B
|
|
>Global Config Entities</B
|
|
></P
|
|
><DL
|
|
><DT
|
|
><TT
|
|
CLASS="SGMLTAG"
|
|
> md5 </TT
|
|
></DT
|
|
><DD
|
|
><P
|
|
> This enables the generation of the Content-MD5: header. This greatly increases the
|
|
|
|
cost of creating a cached response for this virtual, because the MD5 function must
|
|
|
|
be applied to the entire content of the response. Once the response is created, though,
|
|
|
|
there is no per-request overhead. </P
|
|
></DD
|
|
><DT
|
|
><TT
|
|
CLASS="SGMLTAG"
|
|
> prepop </TT
|
|
></DT
|
|
><DD
|
|
><P
|
|
> This will cause phhttpd to traverse the entire docroot at initialization time and prepare
|
|
|
|
cached responses for all the files it finds. This happens in the back ground during
|
|
|
|
normal operation, so there is no dramatic increase in the time it takes for phhttpd
|
|
|
|
to start serving connections. </P
|
|
></DD
|
|
><DT
|
|
><TT
|
|
CLASS="SGMLTAG"
|
|
> name </TT
|
|
></DT
|
|
><DD
|
|
><P
|
|
> This tag surrounds the string that will be used to identify the server. This string
|
|
|
|
will be compared to the Host: header given in the request from the client, or will
|
|
|
|
be compared to the 'host part' of the full URL if that was given. This will be
|
|
|
|
used in combination with the network address and port pair to determine if a request
|
|
|
|
should be served by a virtual server. </P
|
|
></DD
|
|
><DT
|
|
><TT
|
|
CLASS="SGMLTAG"
|
|
> listen v4=DOT.TED.QU.AD port=PORT </TT
|
|
></DT
|
|
><DD
|
|
><P
|
|
> This virtual server will be chosen to serve an incoming request if that request was
|
|
|
|
made to the network address specified in this entity. There can be as many of these
|
|
|
|
as one likes in a given virtual server, and '*' may be specified for either parameter to
|
|
|
|
indicate that all addresses or ports should match. </P
|
|
></DD
|
|
><DT
|
|
><TT
|
|
CLASS="SGMLTAG"
|
|
> logs </TT
|
|
></DT
|
|
><DD
|
|
><P
|
|
> The logs section of the virtual server define the per virtual log files that should
|
|
|
|
be written to during operation. See the following section on logging. </P
|
|
></DD
|
|
></DL
|
|
></DIV
|
|
> </P
|
|
></DIV
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="introduction.html"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="logging.html"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Introduction</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
> </TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>Logging</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |