📄 config-overview.xtp
字号:
<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"><http></a> port, adding<a href="port-tags.xtp#openssl"><openssl></a> port, new <a href="env-tags.xtp#database"><database></a> configuration or<a href="env-tags.xtp#authenticator"><authenticator></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"><resin xmlns="http://caucho.com/ns/resin" xmlns:resin="http://caucho.com/ns/resin/core"> <cluster id="app-tier"> <server id=""> <http port="8080"/> </server> <resin:import path="${resin.home}/conf/app-default.xml"/> <host id=""> <web-app-deploy path="webapps"/> </host> </cluster></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="<resin>"><p>The <a href="resin-tags.xtp#resin"><resin></a> tag is a containerfor all the Resin configuration. It will generally contain one ormost <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="http://caucho.com/ns/resin""><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="http://caucho.com/ns/resin/core""><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"><resin:import></a>,<a href="config-control.xtp#resin:set"><resin:set></a>, and <a href="config-control.xtp#resin:if"><resin:if></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="<cluster>"><p>The <a href="cluster-tags.xtp#cluster"><cluster></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"><server></a> ina <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="<server>"><p>A <a href="server-tags.xtp#server"><server></a> configures asingle JVM instance running Resin. There may be multiple servers in a<a href="cluster-tags.xtp#cluster"><cluster></a> and there may alsobe multiple servers on a machine.</p><p>The <server> will have a unique <var>id</var> which matches the<var>-server</var> command-line argument.</p><p>The <server> will also configure any<a href="port-tags.xtp#http"><http></a> ports, any setuid<a href="server-tags.xtp#user-name"><user-name></a> changesand any<a href="server-tags.xtp#thread-max"><thread-max></a>, <a href="server-tags.xtp#socket-timeout"><socket-timeout></a>, or<a href="server-tags.xtp#keepalive-max"><keepalive-max></a> values.</p><p>Typically, common configuration for multiple serverslike <http> and <thread-max> will be put in a<a href="server-tags.xtp#server-default"><server-default></a> tag tosimplify the configuration.</p></s2><s2 title="<http>"><p>The <a href="port-tags.xtp#http"><http></a> tag configuresHTTP ports. It may contain <a href="port-tags.xtp#openssl"><openssl></a> tags for SSL support.</p><p>The <http> tags are often put in a <server-default> tag, sharingthe configuration for all servers in a cluster.</p></s2><s2 title="<resin:import>"><p>The <a href="config-control.xtp#resin:import"><resin:import></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="<host>"><p>The <a href="host-tags.xtp#host"><host></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<host> 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="<web-app-deploy>"><p>The <a href="webapp-tags.xtp#web-app"><web-app></a> and <a href="webapp-tags.xtp#web-app-deploy"><web-app-deploy></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 <web-app-deploy> 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"><host-deploy></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"><host></a>,<a href="host-tags.xtp#host-deploy"><host-deploy></a>, and<a href="host-tags.xtp#host-default"><host-default></a> tagslet sites choose where to put their virtual hosts.</p><p>The following example shows both the <host> and <host-deploy>methods of configuring virtual hosts. The <host>for <var>www.foo.com</var> directly configures the foo.com site inthe resin.xml. The <host-deploy> for <var>hosts</var> configuresa host deployment directory. Any directory added to <var>hosts</var> willautomatically create a new virtual host. Finally, the <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"><resin xmlns="http://caucho.com/ns/resin"> <cluster id="app-tier"> <root-directory>/var/www</root-directory> <server ... /> <host-default> <web-app-deploy path="webapps"/> <resin:import path="host.xml" optional="true"/> </host-default>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -