⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 config-overview.xtp

📁 RESIN 3.2 最新源码
💻 XTP
📖 第 1 页 / 共 2 页
字号:
<document><header>  <title>Resin Configuration Overview</title>  <description>  <p>The overview briefly describes much of the interesting Resin configurationoptions as an introduction and index to the configurationdocumentation.</p>  </description></header><body><localtoc/><s1 title="Introduction"><p>Many sites will use the default resin.xml with only minimalconfiguration changes, e.g. changing the<a href="port-tags.xtp#http">&lt;http&gt;</a> port, adding<a href="port-tags.xtp#openssl">&lt;openssl&gt;</a> port, new <a href="env-tags.xtp#database">&lt;database&gt;</a> configuration or<a href="env-tags.xtp#authenticator">&lt;authenticator&gt;</a> forsecurity.  Those sites can use the default resin.xml as ansample index into the configuration tags to be customized.</p><p>This overview provides an overview of some of the other customizationsavailable in the resin.xml.  For example some sites have havemore sophisticated requirements, eitheradding many <a href="virtual-host.xtp">virtual hosts</a>, <a href="cluster-tags.xtp#cache">proxy caching</a>, <a href="resin-clustering.xtp">load-balancing</a>, or adding<a href="sessions.xtp">distributed sessions.</a></p></s1><s1 title="Minimal resin.xml"><p>As a starting point to the structure of Resin's configuration, it'sbest to look at the minimal usable resin.xml file.  All configurationin Resin ultimately derives from the top-level resin.xml file, sounderstanding and debugging a configuration can start from the resin.xmland work toward any included files such as <g>resin-web.xml</g>.</p><p>The minimal usable resin.xml file listens to HTTP at port 8080and looks for web-apps in webapps.  So the URL<var>http://localhost:8080/test.php</var> would look in$SERVER_ROOT/webapps/ROOT/test.php.</p><p>$SERVER_ROOT defaults to $RESIN_HOME, i.e. the resin-3.1.0 directory.It can also be assigned with a command-line argument<var>--server-root</var></p><example title="minimal resin.xml">&lt;resin xmlns="http://caucho.com/ns/resin"       xmlns:resin="http://caucho.com/ns/resin/core">  &lt;cluster id="app-tier">    &lt;server id="">      &lt;http port="8080"/>    &lt;/server>    &lt;resin:import path="${resin.home}/conf/app-default.xml"/>    &lt;host id="">      &lt;web-app-deploy path="webapps"/>    &lt;/host>  &lt;/cluster>&lt;/resin></example><p>To start Resin with this minimal resin.xml use the following:</p><example>share> java -jar resin-3.1.0/lib/resin.jar</example><p>Or to start Resin as a daemon use "start":</p><example>share> java -jar resin-3.1.0/lib/resin.jar start</example><s2 title="&lt;resin&gt;"><p>The <a href="resin-tags.xtp#resin">&lt;resin&gt;</a> tag is a containerfor all the Resin configuration.  It will generally contain one ormost &lt;cluster> configuration.  In more complete configuration, itmay also contain <a href="config-log.xtp">logging</a>, <a href="env-tags.xtp#class-loader">class loader</a>,<a href="env-tags.xtp#system-property">system-property</a> or globalresource definitions.</p></s2><s2 title="Namespace xmlns=&quot;http://caucho.com/ns/resin&quot;"><p>The namespace declaration of <var>http://caucho.com/ns/resin</var>enables Resin's validation of the configuration files.  The validatorwill detect syntax errors and provide a summary of the syntax tohelp debug resin.xml files.</p></s2><s2 title="Namespace xmlns:resin=&quot;http://caucho.com/ns/resin/core&quot;"><p>The namespace declaration of <var>http://caucho.com/ns/resin/core</var>enables Resin control tags like<a href="config-control.xtp#resin:import">&lt;resin:import&gt;</a>,<a href="config-control.xtp#resin:set">&lt;resin:set&gt;</a>, and <a href="config-control.xtp#resin:if">&lt;resin:if&gt;</a>.  These controltags can help organize configuration files, but you should take care notto overuse them, which might overcomplicate the configuration file.</p></s2><s2 title="&lt;cluster&gt;"><p>The <a href="cluster-tags.xtp#cluster">&lt;cluster&gt;</a> tagconfigures clusters of servers.  The cluster consists of a numberof virtual hosts, possibly including a default virtual host.  Each<a href="server-tags.xtp#server">&lt;server&gt;</a> ina &lt;cluster> handles the same requests.</p><p>A web-site using Resin's <a href="resin-clustering.xtp">loadbalancing</a> might have two clusters: a web-tier handling the HTTP requestsand an app-tier handling servlets, PHP and JSP pages.</p></s2><s2 title="&lt;server&gt;"><p>A <a href="server-tags.xtp#server">&lt;server&gt;</a> configures asingle JVM instance running Resin. There may be multiple servers in a<a href="cluster-tags.xtp#cluster">&lt;cluster&gt;</a> and there may alsobe multiple servers on a machine.</p><p>The &lt;server> will have a unique <var>id</var> which matches the<var>-server</var> command-line argument.</p><p>The &lt;server> will also configure any<a href="port-tags.xtp#http">&lt;http&gt;</a> ports, any setuid<a href="server-tags.xtp#user-name">&lt;user-name&gt;</a> changesand any<a href="server-tags.xtp#thread-max">&lt;thread-max&gt;</a>, <a href="server-tags.xtp#socket-timeout">&lt;socket-timeout&gt;</a>, or<a href="server-tags.xtp#keepalive-max">&lt;keepalive-max&gt;</a> values.</p><p>Typically, common configuration for multiple serverslike &lt;http> and &lt;thread-max&gt; will be put in a<a href="server-tags.xtp#server-default">&lt;server-default&gt;</a> tag tosimplify the configuration.</p></s2><s2 title="&lt;http&gt;"><p>The <a href="port-tags.xtp#http">&lt;http&gt;</a> tag configuresHTTP ports.  It may contain <a href="port-tags.xtp#openssl">&lt;openssl&gt;</a> tags for SSL support.</p><p>The &lt;http> tags are often put in a &lt;server-default> tag, sharingthe configuration for all servers in a cluster.</p></s2><s2 title="&lt;resin:import&gt;"><p>The <a href="config-control.xtp#resin:import">&lt;resin:import&gt;</a> canimport other configuration files to help organize complicatedconfigurations.  The <var>app-default.xml</var> file in the exampledefines the usual servlets that applications expect, like theJSP servlet, the <a href="../quercus/index.xtp">PHP/Quercus</a> servlet,and default configuration like <g>resin-web.xml</g> and <g>web.xml</g>.</p></s2><s2 title="\${resin.home}"><p>Resin's configuration files can use <a href="jsp-el.xtp">EL</a>expressions, including predefined variables like<a href="el-var.xtp#resin">${resin}</a>, <a href="el-var.xtp#cluster">${cluster}</a>, <a href="el-var.xtp#host">${host}</a>, and<a href="el-var.xtp#webApp">${webApp}</a>.</p></s2><s2 title="&lt;host&gt;"><p>The <a href="host-tags.xtp#host">&lt;host&gt;</a> tags configure<a href="virtual-host.xtp">virtual host</a>.  In this minimal example,the host is the default virtual host; it will match any host which other&lt;host&gt; tags do not match.</p><p>More complicated sites with many virtual hosts willoften use a <a href="host-tags.xtp#host-deploy">host-deploy</a> tagto automatically deploy virtual hosts in a <var>hosts</var> deploymentdirectory, and use <a href="host-tags.xtp#host-default">host-default</a>to share common virtual host configuration.</p></s2><s2 title="&lt;web-app-deploy&gt;"><p>The <a href="webapp-tags.xtp#web-app">&lt;web-app&gt;</a> and <a href="webapp-tags.xtp#web-app-deploy">&lt;web-app-deploy&gt;</a>tags configure web-applications.  Web applications are mini-virtual hosts,i.e. sections of the web site that are conceptually distinct fromeach other.  Many sites will only have a single root web-application.</p><p>The &lt;web-app-deploy&gt; tag defines a <var>webapps</var> directorywhich automatically deploys web-applications.  The <var>ROOT</var>web-app is a special name which matches the root URL.</p></s2></s1><s1 title="Virtual Hosts"><p>Adding a <a href="virtual-host.xtp">virtual host</a> with Resin can beas simple as creating new directories and adding content.  The defaultvirtual host hasa <a href="host-tags.xtp#host-deploy">&lt;host-deploy&gt;</a> tag whichdefines a <var>hosts</var> deployment directory.  For example, avirtual host <var>www.foo.com</var> might be browsable as<var>http://www.foo.com/test.php</var>.  Assuming the server-root is<var>/var/www</var>, you can create a new virtual host by adding a file in:</p><example>/var/www/hosts/www.foo.com/webapps/ROOT/test.php</example><p>Of course, Resin's virtual host's can be configured in other directoryconfigurations.  The <a href="host-tags.xtp#host">&lt;host&gt;</a>,<a href="host-tags.xtp#host-deploy">&lt;host-deploy&gt;</a>, and<a href="host-tags.xtp#host-default">&lt;host-default&gt;</a> tagslet sites choose where to put their virtual hosts.</p><p>The following example shows both the &lt;host> and &lt;host-deploy>methods of configuring virtual hosts.  The &lt;host&gt;for <var>www.foo.com</var> directly configures the foo.com site inthe resin.xml.  The &lt;host-deploy&gt; for <var>hosts</var> configuresa host deployment directory.  Any directory added to <var>hosts</var> willautomatically create a new virtual host.  Finally, the &lt;host> with<var>id=""</var> defines the "default" virtual host. Any request not matchingany other host will use the virtual host.</p><example title="resin.xml">&lt;resin xmlns="http://caucho.com/ns/resin">  &lt;cluster id="app-tier">    &lt;root-directory>/var/www&lt;/root-directory>    &lt;server ... />    &lt;host-default>      &lt;web-app-deploy path="webapps"/>      &lt;resin:import path="host.xml" optional="true"/>    &lt;/host-default>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -