📄 config.xtp
字号:
<s1 title="Configuration"><summarylist/><s2 title="How do I change the work directory?"><p><var/<work-dir>/>.<p>By default, that's <var//tmp/caucho/> on Unix and <var/\temp\caucho/> onWindows.</s2><s2 title="How do I use multiple resin.conf files?"><p>This is especially important if you want to use a differentworkspace for development than deployment. Just call the<code/httpd/> executable with the -conf flag.<example>unix> httpd.sh start -conf devel.conf -verbose</example><example>d:\> httpd.exe -conf devel.conf -verbose</example></s2><s2 title="How do I configure a default servlet?"><p>The following will a servlet to handle all unmatched URLs, just likethe FileServlet does by default.</p><example><servlet-mapping url-pattern='/' servlet-name='MyServlet'/></example><p>This has a different effect from <var/url-pattern='/*'/>. <var//*/> willhave priority over extension mappings like <var/*.jsp/>, while <var///> hasthe lowest priority.</p></s2><s2 title="How do I change the 'cannot connect' message?"><p>In the resin.conf, add an <var/error-page/> directive using <var/connection/>for the exception type. The location must be an absolute path understandableto your web server. For example, since the web server will display thismessage, you can't forward to a jsp file.</p><example><error-page exception-type='connection' location='/errorpage.html'/></example></s2><s2 title='How do I set a virtual directory?'><p>Use the <var/<path-mapping>/> directive. For example, to grab imagesfrom /home/images/*, use:</p><example><path-mapping url-pattern='/images/*' real-path='/home/images'/></example></s2><s2 title='What is a web-app?'><p>The vast majority of sites can completely ignore web-apps. If you'restarting with Resin, use the default web-app and don't worry about it.</p><p>You'll only want to use web-apps when you want separate projects usingthe same web server. For example, on an ISP site, each user might get herown web-app. She can treat the web-app as if she had control overthe whole web server starting at a URL prefix like <var/~karen/>.</p><p>A web-app is a generalization of a virtual host. With virtualhosts, each host pretends that it controls its own server when itreally is sharing the server with other virtual hosts. A web-appextends this by creating virtual applications for a URL prefix.</p><p>Each web-app gets its own sessions, servlets, beans and staticpages.</p></s2><s2 title="Why don't my URLs work in my web-app?"><p>Remember, the browser doesn't know about your web-apps. It treats theweb server as a single URL-space. This may cause you troubles if youuse a standard directory structure like putting images in '/images/*'.</p><p>To see this problem, suppose you have a web-app called'/myproject'. Suppose you have a JSP page in the web-app called<var/foo/bar.jsp/>. The full URL will be<var//myproject/foo/bar.jsp/>. Your image reference should look likeone of the following:</p><example><img src='../images/image1.gif'/><br><img src='<%= application.getContextPath() %>/images/image1.gif'/></example><p>Using <var//images/image1.gif/> will fail because the browser willlook for <var/http://myhost.com/images/image1.gif/> when you reallywant <var/http://myhost.com/myproject/images/image1.gif/>.</p></s2><s2 title="How do I use virtual hosts with IIS?"><p>Jan Venema replies,</p><p>This is my working config under IIS 4.0 end Resin1.1b6</p><example><caucho.com> <http-server> <error-log id='log/default-error.log'/> <!-- -- Each virtual host has its own applications, sessions, -- and servlets. You must duplicate the configuration for -- each host. Each host ignores the configuration in -- the outer block. --> <host id='192.168.0.2'> <app-dir>d:\inetpub\wwwroot\inverko</app-dir> <error-log id='d:\inetpub\wwwroot\inverko\error.log'/> <servlet-mapping url-pattern='/servlet/*' servlet-name='invoker'/> <servlet-mapping url-pattern='*.jsp' servlet-name='com.caucho.jsp.JspServlet'/> </host> <host id='192.168.0.3'> <app-dir>d:\inetpub\wwwroot\dmd</app-dir> <error-log id='d:\inetpub\wwwroot\dmd\error.log'/> <servlet-mapping url-pattern='/servlet/*' servlet-name='invoker'/> <servlet-mapping url-pattern='*.jsp' servlet-name='com.caucho.jsp.JspServlet'/> </host> </http-server></caucho.com></example></s2><s2 title="How do I configure error pages in resin.conf?"><p>The basic command is <a href='../ref/app-config.xtp#error-page'>error-page</a>.There are three kinds of error pages</p><ul><li>Error code pages, e.g. 404<li>Exception, e.g. java.lang.NullPointerException<li>connection failures, "can't connect to srun"</ul></s2><s2 title="Where do all the files go?"><p>The document root is set in resin.conf using the app-dir:</p><example><http-server app-dir='/www/htdocs'> ...</http-server></example><p>Each virtual host and each web-app will have its own app-dir.The app-dir configuration must be in resin.conf, not the web.xml (otherwise Resin couldn't find web.xml):</p><example><web-app id='myapp' app-dir='/www/myapp'> ...</web-app></example><p>If you don't specify an app-dir, Resin will use <var/id/>looking in /www/htdocs/myapp in the above example.</p><p>Optionally, you can put a web.xml in [app-dir]/WEB-INF/web.xml(again, following JSDK 2.2). The web.xml can contain anything the<var/web-app/> in resin.conf can.</p><p>Auto-reloaded classes belong in [app-dir]/WEB-INF by default,following JSDK 2.2:</p><def>classes -- auto-load/recompile Java servlet/bean/classes directorylib -- auto-loaded *.jar files</def><p>In the web-app, you can add to the auto-reload classpath using:</p><example><classpath id='myclasses' source='/home/work/proj/src' compile='true'/></example><p>The JSP/Java work directory is /tmp/caucho (or \temp\caucho). You canchange that with:</p><example><java compiler='javac' work-dir='/path/to/my/work/dir'/></example><p>Finally, the startup scripts will look for jars in resin1.1/lib to addto the classpath before starting resin.</p></s2><s2 title="How do I disable directory browsing?"><p>Setting <ahref='../ref/app-config.xtp#directory-servlet'>directory-servlet</a> to"none" will disable directory browsing.</p><example><web-app id='/'> <directory-servlet id='false'/></web-app></example></s2><s2 title="Why do both virtual hosts use the same index.jsp file?"><p>As described in the <a href='../ref/virtual-host.xtp'>virtual host</a>reference, you must use <host> and <app-dir> in your resin.confto configure virtual hosts.</p><p>If you omit the <host>, Resin will generate the same class namefor both hosts. So one host will see the JSP from the second host.By adding the <host>, Resin will make the class names unique.</p></s2><s2 title="How do I use a servlet as the welcome page?"><p>There's no <var/url-pattern/> that will only match '/'. url-pattern='/'will set the servlet as the default servlet, replacing the file servlet.</p><p>You'll need to use Resin's <var/url-regexp/>. <var/url-regexp='^/$'/>will do the trick.</p></s2></s1>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -