📄 http-config.xtp
字号:
<s1 title="Servlet and Host Configuration"><p>HTTP and Srun configuration is identical except for load balancing(<var/srun/> and <var/srun-backup/>.)</p><p>HTTP configuration follows the Servlet 2.2 deployment descriptors.The nesting depth is important, but order is generally not important.In the sections that follow, the sectionheader tells where the attribute belongs. For example, the<var/servlet-mapping/> configuration in<var/caucho.com/http-server/host/web-app/> looks like:</p><example><caucho.com> <http-server> <host id=''> <web-app id='/'> <servlet-mapping url-pattern='/test' .../> </web-app> </host> </http-server></caucho.com></example><p>Most of the interesting configuration belongs in<a href="app-config.xtp">web-app</a>. For example, <var/servlet-mapping/>belongs in a <var/web-app/> element, but<var/thread-max/> belongs in the top-level <var/http-server/> element.</p><p>The server contains a number of <var/host/> elements and each<var/host/> contains <var/web-app/> elements. Each <var/host/>configures a virtual host and each <var/web-app/> configures anapplication.</p><example title='Full Configuration'><caucho.com><http-server> <host id='gryffindor.caucho.com' app-dir='gryffindor'> <web-app id='/'> <servlet-mapping .../> ... </web-app> <web-app id='/test' app-dir='/usr/local/test'> ... </web-app> </host> <host id='slytherin.caucho.com' app-dir='slytherin'> ... </host> ...</http-server></caucho.com></example><objsummary/><s2 title='http-server'><defun name='http-server' title='http-server'><p>Configuration for the servlet engine.</p><p>Any <resource-ref> resource configured in <http-server> isshared for all virtual hosts and web-apps in the server. So a databaseor EJB server configured in the <http-server> will be sharedfor all virtual hosts.</p><p>Default application tags like<servlet-mapping> may appear in the <http-server> section. Thesetags will be defaults for the contained <web-app> and <host>.</defun><defun title='alternate-session-url-prefix' version="Resin 2.0.5"><p>Configures an alternate URL prefix to be used for /~J=xxx/test.jspstyle url-rewriting. There is no default.</p><p>If alternate-session-url-prefix is configured, URL rewriting willadd the session to the beginning of the URL as a path prefix instead of thestandard ;jsessionid= suffix. For clients like mobile devices with limitedmemory, this will allow careful web designers to minimize the page size.</p><example>...<http-server> <alternate-session-url-prefix>/~J=</alternate-session-url-prefix> ...</example></defun><defun title='cache' version='Resin 1.1'><p>Activates the memory cache with a specified size. Resin'scache acts as a proxy cache. Pages with <var/expires/> headers willbe cached, avoiding expensive Java or Database processing.</p><p>To activate caching, you must add a cache directive. By default,caching is disabled.</p><p>The cache combines memory and file caching. The most referencedpages are served out of memory and the rest are served from thefilesystem.</p><deftable><tr><th>Attribute<th>Meaning<th>Default<tr><td>dir<td>File directory to store the cached pages<td>resin1.2/cache<tr><td>entries<td>Number of entries allowed in the memory cache<td>16386<tr><td>size<td>Size in kilobytes of the memory<td>1024<tr><td>enable<td>true or false to disable<td>true</deftable><p>For example, a page created by several sophisticated and slowdatabase queries may only change every 15 minutes. If that page setsits expires header, Resin can serve the generated page as fast as astatic page.</p><p><b>Default:</b> by default, cache is disabled.</p></defun><defun title='error-log'><p>Specifies the file for error logging. The log is relativeto $RESIN_HOME. You can use the special path <var/$app-dir/> to makethe log relative to the host, e.g. <var/$app-dir/WEB-INF/log/access.log/>.</p><example><caucho.com><http-server error-log='log/error.log'><host id='foo.com' error-log='log/foo.log'> ...</host></http-server></caucho.com></example><deftable title="error-log attributes"><tr><th>Attribute<th>Meaning<th>Default<tr><td>encoding<td>character encoding<td>The JVM's default<tr><td>href<td>The log's filename<td>required<tr><td>rollover-period<td>How often the log should be rotated<td>never<tr><td>rollover-size<td>How large the log can be before rotating<td>infinite<tr><td>timestamp<td>Format for a timestamp before each entry<td>none</deftable><p><b>Default:</b> By default, a host's error log will use anerror-log defined in http-server.</p></defun><defun name=error-page title='error-page' index='error-page'><p>The url to display if the web server can't connect to Resin.This is a special case of <a href='app-config.xtp#error-page'>error-page</a>in the web-app configuration.</p><p>The Apache and IIS plugins use this special error-page directive todisplay a custom error page when the web server can't connect to Resin.The location must be an absolute path understandable to the web server.</p><example><caucho.com> <http-server> <error-page exception-type='connection' location='/connection_error.html'/<> </http-server></caucho.com></example></defun><defun title='forbid-host' version='Resin 2.0.3'><p>Selects a list of IPs that are forbidden.</p><example><http-server> <forbid-host>192.168.0.1</forbid-host> <forbid-host>192.168.0.2</forbid-host> ...</http-server></example><p>forbid-host is implemented by com.caucho.http.security.ForbidHost. It isstored in JNDI as java:comp/env/caucho/forbid-host. An intelligentlog might detect a denial of service attack and dynamically forbid the host.</p></defun><defun name=ignore title='ignore-client-disconnect' version='Resin 1.2.3'><p>Ignores ClientDisconnectionExceptions thrown when the browserdisconnects.</p><example><caucho.com> <http-server> <ignore-client-disconnect>false</ignore-client-disconnect> ... </http-server></caucho.com></example><p>False by default, throws exceptions on disconnects.</p></defun><defun title='global-system-properties' version="Resin 2.0.5"><p>Determines if system-properties are classloader specific or global.</p><p>By default, Resin's web-apps and hosts have isolated system properties.So System.getProperty("test") in host foo.com might return a different valuefrom System.getProperty("test") in host bar.com. Usually, this is thecorrect solution to prevents hosts and web-apps from affecting each other.Specialized applications may want to disable this feature however.</p><example>...<http-server> <global-system-properties>true</global-system-properties> ...</http-server></example><p><b>Default:</b> The default value is false.</p></defun><defun title='host'><p>Defines a virtual host. If no hosts are specified, or if arequest doesn't match a host, configuration in http-server will beused instead.</p><p>The id may contain a list of hosts. Any host in the list willmatch.</p><p>See <a href='app-config.xtp'>application configuration</a> forservlet configuration.</p><p>Hosts can use <var/regexp/> instead of <var/id/> to dynamically createnew hosts.</p><deftable><tr><th>Attribute<th>Meaning<th>Default<tr><td>id<td>The host name<td>required<tr><td>regexp<td>A regular expression matching hosts.<td>none<tr><td>app-dir<td>The root directory of the host (can use replacement vars)<td>use http-server app-dir</deftable><p>Any <resource-ref> resource configured in <http-server> isshared for all virtual hosts and web-apps in the server. So a databaseor EJB server configured in the <http-server> will be sharedfor all virtual hosts.</p><p>Default application tags like<servlet-mapping> may appear in the <http-server> section. Thesetags will be defaults for the contained <web-app> and <host>.<example><caucho.com><http-server><host id='www.foobar.com, foobar.com' app-dir='foobar/docs'> <web-app id='/'> <servlet-mapping url-pattern='/servlets/*' servlet-name='invoker'/> </web-app></host><host regexp='([^.]*).users.com' app-dir='/home/$1/public_html'> ...</host></http-server></caucho.com></example><note>Only the Resin Java process understands regexps. Because mod_caucho,isapi_srun and the other web server plugins don't understand the regexps,you may need to do additional work to make the web server send the requestto Resin.</note><p><b>Default:</b> If the <var/id/> attribute is null or '*', the <host>will be used as the default configuration for any virtual host that doesn'tmatch a specific <host> block.</p></defun><defun title='http' version="Resin 1.2"><p>Defines a HTTP or SSL port for the standalone server.</p><deftable><tr><th>Attribute<th>Meaning<tr><td>id<td>http identifier name<tr><td>host<td>The listening host<tr><td>port<td>The listening port<tr><td>virtual-host<td>Virtual host to select a <a href="#host">host</a> block.<tr><td>ssl<td>enable ssl<tr><td>key-store-type<td>JSSE Type of the key store (default jks)<tr><td>key-store-file<td>JSSE File containing the certificates<tr><td>key-store-password<td>JSSE Password to read the certificates<tr><td>key-manager-factory<td>JSSE key manager factory type<tr><td>ssl-context<td>JSSE ssl context type<tr><td>certificate-file<td>OpenSSL certificate (Resin 2.0.5)<tr><td>certificate-key-file<td>OpenSSL key certificate (Resin 2.0.5)<tr><td>certificate-key-password<td>OpenSSL key password (Resin 2.1.1)<tr><td>crypto-device<td>OpenSSL engine (Resin 2.0.5)<tr><td>thread-max<td>Maximum number of live threads.<td>200<tr><td>thread-min<td>Minimum number of live threads.<td>5<tr><td>thread-keepalive<td>Number of keepalive threads<td>100<tr><td>request-timeout<td>Max time for a request, after this the requestwill be interrupted.<td>30 sec<tr><td>listen<td>Value of the socket listen parameter<td>5<tr><td>accept-buffer-size<td>Number of sockets in the accept buffer.<td>256<tr><td>shutdown-wait-time<td>How long to wait for connections tofinish before exiting.<td>10 sec.</deftable><example title='Basic HTTP configuration'><caucho.com> <http-server> <http port='8080'> ... </http-server></caucho.com></example><example title='JSSE configuration'><caucho.com> <http-server> <http port='8443'> <ssl>true</ssl> <key-store-type>pkcs12</key-store-type> <key-store-file>keys/server.p12</key-store-file> <key-store-password>changeit</key-store-password> </http> ... </http-server></caucho.com></example></defun><defun name=ping title='ping' index='ping'><p>Specifies a list of URLs to test to check the webserver's uptime.Ping adds reliability to a web site. It launches a separate thread tocheck if a list of URLs return valid results, i.e. HTTP status 200. If theURLs fail after repeated attempts, Resin will exit. The parent process,either wrapper.pl or the NT service, will automatically restart Resin.</p><p>Because the ping thread is in the same JVM as the web server,ping cannot detect all failure types. In particular, if the JDK itselffreezes, ping can do nothing. It can detect problems like deadlocksor database connection overflows or memory leaks.</p><p>The URLs listed in the <ping> should exercise the important operationsin the application. For example, it should at least access the database.</p><deftable><tr><th>Attribute<th>Meaning<th>Default<tr><td>url<td>URL to test for failure<td>required<tr><td>sleep-time<td>time to sleep between pings.<td>15 min<tr><td>retry-count<td>how many times to retry failures before restarting.<td>3<tr><td>retry-time<td>how long to sleep between failures.<td>1 sec<tr><td>class-name<td>specify a custom ping class (Resin 2.0.3)<td>com.caucho.http.admin.PingThread <tr><td>socket-timeout<td>how long the socket should wait for a response before timing out.<td>10s</deftable><example><caucho.com><http-server> <ping> <sleep-time>1m</sleep-time> <retry-count>3</retry-count> <retry-time>1s</retry-time> <url>http://localhost:8080/test.jsp</url> </ping> ...</http-server></caucho.com></example><p>Custom ping classes must extend com.caucho.http.admin.PingThread.For example, the PingMailer will mail when the PingThread fails.</p><deftable title='PingMailer additional Attributes'><tr><td>Attribute<th>Meaning<th>Default<tr><td>mail-to<td>Recipient of the warning mail<td>required<tr><td>mail-from<td>Sender of the mail<td>the user of the Resin process<tr><td>mail-subject<td>The subject of the mail<td>"Resin ping has failed"</deftable><example><ping> <class-name>com.caucho.http.admin.PingMailer</class-name> <sleep-time>1m</sleep-time> <retry-count>3</retry-count> <retry-time>1s</retry-time> <url>http://localhost:8080/test.jsp</url> <mail-to>webmaster@localhost</mail-to></ping></example><p>No default.</p></defun>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -