📄 host-tags.xtp
字号:
<document><header> <title><host>: Virtual Host configuration</title> <version>Resin 3.1</version> <description> <p>Describes the virtual host configuration tags.</p> </description></header><body><localtoc/><s1 title="See Also"><ul><li>See the <a href="index-tags.xtp">index</a> for a list of all the tags.</li><li>See <a href="webapp-tags.xtp">Web Application</a> configuration for web.xml (Servlet) configuration.</li><li>See <a href="env-tags.xtp">Resource</a> configuration for resources: classloader, databases, JMS, EJB, and IoC beans.</li><li>See <a href="config-log.xtp">Log</a> configuration for access log configuration, java.util.logging, and stdout/stderr logging.</li></ul></s1><defun title="<access-log>" version="Resin 2.1"><parents>cluster, host, web-app</parents><p><access-log> configures the access log file.</p><p>As a child of <a config-tag="web-app"/>, overrides thedefinition in the <a config-tag="host"/> that the web-app isdeployed in. As a child of <a config-tag="host"/>, overrides thedefinition in the <a config-tag="server"/> that the host isin.</p><deftable title="<access-log> Attributes"><tr> <th>Attribute</th> <th>Description</th> <th>Default</th></tr><tr> <td>archive-format</td> <td>the format for the archive filename when a rollover occurs, see <a href="#rollover">Rollovers</a>. </td> <td>see below</td></tr><tr> <td>format</td> <td>Access log format.</td> <td>see below</td></tr><tr> <td>hostname-dns-lookup</td> <td>log the dns name instead of the IP address (has a performance hit).</td> <td>false</td></tr><tr> <td>path</td> <td>Output path for the log entries,see <a href="config-log.xtp#path">"Log Paths"</a>.</td> <td>required</td></tr><tr> <td>rollover-period</td> <td>how often to rollover the log. Specify in days (15D), weeks (2W), months (1M), or hours (1h). See <a href="#rollover">Rollovers</a>. </td> <td>none</td></tr><tr> <td>rollover-size</td> <td>maximum size of the file before a rollover occurs, in bytes (50000), kb (128kb), or megabytes (10mb). See <a href="#rollover">Rollovers</a>. </td> <td>1mb</td></tr><tr> <td>resin:type</td> <td>a class extending <a href="javadoc|com.caucho.server.log.AccessLog|"/> for custom logging </td> <td>com.caucho.server.log.AccessLog</td></tr><tr> <td>init</td> <td>Resin-IoC initialization for the custom class</td> <td>n/a</td></tr></deftable><def title="<access-log> schema">element access-log { auto-flush? & archive-format? & auto-flush-time? & exclude? & format? & path? & rollover-count? & rollover-period? & rollover-size? & init?}</def><p>The default archive format is</p><pre> <var>path</var> + ".%Y%m%d" or <var>path</var> + ".%Y%m%d.%H" if rollover-period < 1 day.</pre><p>The access log formatting variables follow the Apache variables:</p><!-- duplicated in config-log.xtp, cluster.xtp, host-tags.xtp --><deftable title="format patterns"><tr> <th>Pattern</th> <th>Description</th></tr><tr><td>%b</td> <td>result content length</td></tr><tr><td>%D</td> <td>time taken to complete the request in microseconds (since 3.0.16)</td></tr><tr><td>%h</td> <td>remote IP addr</td></tr><tr><td>%{<var>xxx</var>}i</td> <td>request header <var>xxx</var></td></tr><tr><td>%{<var>xxx</var>}o</td> <td>response header <var>xxx</var></td></tr><tr><td>%{<var>xxx</var>}c</td> <td>cookie value <var>xxx</var></td></tr><tr><td>%n</td> <td>request attribute</td></tr><tr><td>%r</td> <td>request URL</td></tr><tr><td>%s</td> <td>status code</td></tr><tr><td>%{<var>xxx</var>}t</td> <td>request date with optional time format string.</td></tr><tr><td>%T</td> <td>time taken to complete the request in seconds</td></tr><tr><td>%u</td> <td>remote user</td></tr><tr><td>%U</td> <td>request URI</td></tr></deftable><p>The default format is:</p><def title="default access log format">"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""</def><p><var>resin:type</var> allows for custom logging. Applications canextend a custom class from <a href="javadoc|com.caucho.http.log.AccessLog|"/>. <a href="resin-ioc.xtp">Resin-IoC initialization</a> can be used to set beanparameters in the custom class.</p><example title="Example: <access-log> in host configuration"><resin xmlns="http://caucho.com/ns/resin"><cluster id="app-tier"> <host id=""> <access-log path='log/access.log'> <rollover-period>2W</rollover-period> </access-log> </host></cluster></resin></example><example title="Example: custom access log"><resin xmlns="http://caucho.com/ns/resin"><cluster id="app-tier"> <host id='foo.com'> <access-log resin:type='test.MyLog'> path='${resin.root}/foo/error.log' rollover-period='1W'> <init> <foo>bar</foo> </init> </access-log> ... </host></cluster></resin></example></defun> <defun title="<ear-deploy>"><parents>host, web-app</parents><p>Specifies ear expansion.</p><p>ear-deploy can be used in web-apps to define a subdirectoryfor ear expansion.</p><deftable title="<ear-deploy> Attributes"><tr> <th>Attribute</th> <th>Description</th> <th>Default</th></tr><tr> <td>archive-path</td> <td>The path to the directory containing ear files</td> <td>path</td></tr><tr> <td>ear-default</td> <td>resin.xml default configuration for all ear files, e.g. configuringdatabase, JMS or EJB defaults.</td> <td></td></tr><tr> <td>expand-cleanup-fileset</td> <td>Specifies the files which should be automatically deleted when anew .ear version is deployed.</td> <td></td></tr><tr> <td>expand-directory</td> <td>directory where ears should be expanded</td> <td>value of <var>path</var></td></tr><tr> <td>expand-prefix</td> <td>automatic prefix of the expanded directory</td> <td>_ear_</td></tr><tr> <td>expand-suffix</td> <td>automatic suffix of the expanded directory</td> <td></td></tr><tr> <td>lazy-init</td> <td>if true, the ear file is only started on first access</td> <td>false</td></tr><tr> <td>path</td> <td>The path to the deploy directory</td> <td>required</td></tr><tr> <td>redeploy-mode</td> <td>"automatic" or "manual". If automatic, detects new .ear filesautomatically and deploys them.</td> <td>automatic</td></tr><tr> <td>url-prefix</td> <td>optional URL prefix to group deployed .ear files</td> <td></td></tr></deftable><def title="<ear-deploy> schema">element ear-deploy { path & archive-directory? & ear-default? & expand-cleanup-fileset? & expand-directory? & expand-path? & expand-prefix? & expand-suffix? & lazy-init? & redeploy-mode? & require-file* & url-prefix?}</def></defun><defun title="<error-page>" version="Resin 3.1"><parents>cluster, host, webapp</parents><p><error-page> defines a web page to be displayed when an error occursoutside of a web-app.Note, this is not a default error-page, i.e. ifan error occurs inside of a <web-app>, the error-page forthat web-app will be used instead.</p><p>See <a href="webapp.xtp#error-page">webapp: error-page</a>.</p></defun><defun title="<host>" version="Resin 3.0"><parents>cluster</parents><p><host> configures a virtual host. Virtual hosts must beconfigured explicitly.</p><deftable title="<host> Attributes"><tr> <th>Attribute</th> <th>Description</th> <th>Default</th></tr><tr><td>id</td> <td>primary host name</td> <td>none</td></tr><tr><td>regexp</td> <td>Regular expression based host matching</td> <td>none</td></tr><tr><td>host-name</td> <td>Canonical host name</td> <td>none</td></tr><tr><td>host-alias</td> <td>Aliases matching the same host</td> <td>none</td></tr><tr><td>secure-host-name</td> <td>Host to use for a redirect to SSL</td> <td>none</td></tr><tr><td>root-directory</td> <td>Root directory for host files</td> <td>parent directory</td></tr><tr><td>startup-mode</td> <td>'automatic', 'lazy', or 'manual', see <a href="resin-tags.xtp#startup-mode">Startup and Redeploy Mode</a></td> <td>automatic</td></tr></deftable><example title="Example: explicit host in resin.xml"><resin xmlns="http://caucho.com/ns/resin"><cluster id=""><host host-name="www.foo.com"> <host-alias>foo.com</host-alias> <host-alias>web.foo.com</host-alias> <root-directory>/opt/www/www.foo.com</root-directory> <web-app id="/" document-directory="webapps/ROOT"> </web-app> ...</host></cluster></resin></example><example title="Example: regexp host in resin.xml"><resin xmlns="http://caucho.com/ns/resin"><cluster id=""><host regexp="([^.]+)\.foo\.com"> <host-name>${host.regexp[1]}.foo.com</host-name> <root-directory>/var/www/hosts/www.${host.regexp[1]}.com</root-directory> ...</host></cluster></resin></example><p>It is recommended that any <host> using a regexp includea <host-name> to set the canonical name for the host.</p></defun><defun title="<host-alias>"><p><host-alias> defines a URL alias for matching HTTP requests.Any number of <host-alias> can be used for each alias.</p><p>The host-alias can be used either in the resin.xml or ina host.xml when use host-deploy together with resin:import.</p><def title="<host-alias> schema">element host-alias { string}</def><example title="Example: host-alias in the resin.xml"><resin xmlns="http://caucho.com"><cluster id=""> <host id="www.foo.com" root-directory="/var/www/foo.com"> <host-alias>foo.com</host-alias> <web-app id=""/> </host></cluster></resin></example><p>Since the <host-deploy> and <host> tags lets you add ahost.xml file to customize configuration, the <host-alias> canalso fit in the custom host.xml page.</p><example title="Example: host-alias in a /var/www/hosts/foo/host.xml"><host xmlns="http://caucho.com"> <host-name>www.foo.com</host-name> <host-alias>foo.com</host-alias> <web-app id="" root-directory="htdocs"/></host></example></defun><defun title="<host-alias-regexp>"><p><host-alias-regexp> defines a regular expression for matchingURLs for a given virtual host.</p><def title="<host-alias-regexp> schema">element host-alias-regexp { string}</def><example title="Example: host-alias-regexp in the resin.xml"><resin xmlns="http://caucho.com"><cluster id=""> <host id="www.foo.com" root-directory="/var/www/foo.com"> <host-alias-regexp>.*foo.com</host-alias-regexp> <web-app id=""/> </host></cluster></resin></example></defun><defun title="<host-default>" version="Resin 3.0"><parents>cluster</parents><p><host-default> configures defaults for a virtual host.</p><p>The host-default can contain any of the host configuration tags.It will be used as defaults for any virtual host.</p></defun><defun title="<host-deploy>" version="Resin 3.0.4"><parents>cluster</parents><p><host-deploy> configures an automatic deployment directoryfor virtual host.</p><deftable title="<host-deploy> Attributes"><tr> <th>Attribute</th> <th>Description</th> <th>Default</th></tr><tr> <td>archive-directory</td> <td>path to the archive directory</td> <td>path</td></tr><tr> <td>path</td> <td>path to the deploy directory</td> <td>required</td></tr><tr> <td>expand-cleanup-fileset</td> <td>an ant-style fileset defining which directories to cleanup when
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -