📄 cse-apache-win.xtp
字号:
<s1 title="Resin with Apache on Windows"><p>Resin provides a fast servlet runner for Apache, allowing Apacheto run servlets and JSP files.</p><figure src='apache_srun.gif'/><summarylist/><s2 title='Configuring Apache'><p>To configure Apache to load the Caucho Server Runner, add thefollowing lines to the Apache httpd.conf file:</p><example title=httpd.conf>LoadModule caucho_module <installdir>/resin-2.1.0/libexec/apache-1.3/mod_caucho.dll# Note, AddModule not needed for Apache 2.0AddModule mod_caucho.c<IfModule mod_caucho.c> CauchoConfigFile <installdir>/resin-2.1.0/resin.conf <Location /caucho-status> SetHandler caucho-status </Location></IfModule></example><note>The caucho-status is optional and probably should be avoided ina production site. It lets you ask the Caucho Apache module about theCaucho status, valuable for debugging.</note><s3 title='Alternate Apache Configuration'><p>You can also configure Apache directly, instead of lettingmod_caucho read the configuration from the resin.conf file.If you use this method, you need ensure the Apache configuration matches the Resin configuration.</p><example title=httpd.conf>LoadModule caucho_module <installdir>/resin-2.1.0/libexec/apache-1.3/mod_caucho.dllAddModule mod_caucho.cCauchoHost localhost 6802AddHandler caucho-request jsp<Location /servlet/*> SetHandler caucho-request</Location></example><deftable><tr><th>Apache Command<th>Meaning<tr><td>CauchoConfigFile <var/conf/><td>Reads <var/conf/> for the Resin configuration.<tr><td>CauchoServerRoot <var/directory/><td>Configures the equivalent of -server-root.<tr><td>CauchoHost <var/host/> <var/port/><td>Adds the Resin JVM at <var/host:port/> as a servlet runner.<tr><td>CauchoBackup <var/host/> <var/port/><td>Adds the Resin JVM at <var/host:port/> as a backup servlet runner.<tr><td></deftable></s3><s3 title="Dispatching"><p>mod_caucho selects URLs specified by the servlet-mapping directives to go toResin. Other URLs stay with Apache. There's a more completediscussion of the URL dispatching in the <ahref="../java_tut/plugin-dispatch.xtp">plugin-dispatch</a> tutorial.</p></s3></s2><s2 title='Load Balancing' version='Resin 1.2'><p>In Resin 1.2, you can distribute requests to multiple machines. Allrequests in a session will go to the same host. In addition, if onehost goes down, Resin will send the request to the next available machine.</p><p>In addition, you can specify backup machines. The backup only will serverequests if all primaries are down.</p><p>See the <a href='http-config.xtp'>http config</a> section for moredetails.</p><example title=resin.conf><caucho.com><http-server> <srun id="a" host='host1' port='6802'/> <srun id="b" host='host2' port='6802'/> <srun-backup id="c" host='backup port='6802'/> ...</http-server></caucho.com></example></s2><s2 title='Error Page' version='Resin 1.2'><p>When mod_caucho can't reach any JVM, it will send a default errorpage. Sites can customize the error page with the<var/error-page/> directive in the resin.conf.</p><example title=resin.conf>...<web-app> <error-page exception-type='connection' location='/conn_error_page.html'/> ...</web-app></example></s2><s2 title='Configuring resin.conf'><p>By default, Resin will look in resin-2.1.0/doc for JSP files andresin-2.1.0/doc/WEB-INF/classes for servlets and beans. To tell Resinto use Apache's document area, you configure the <var/app-dir/>.Change <var/app-dir/> from 'doc' to something like '/usr/local/apache/htdocs'.</p><example title='resin.conf'><caucho.com> <http-server app-dir='/usr/local/apache/htdocs'> <servlet-mapping url-pattern='/servlets/*' servlet-name='invoker'/> <servlet-mapping url-pattern='*.xtp' servlet-name='com.caucho.jsp.XtpServlet'/> <servlet-mapping url-pattern='*.jsp' servlet-name='com.caucho.jsp.JspServlet'/> </http-server></caucho.com></example></s2><s2 title='Testing the servlet engine'><p>Now you need to start the servlet engine. From the resin-2.1.0/binfolder, click on srun.</p><example>> resin-2.0/bin/httpd</example><p>Now browse http://localhost/test.jsp. You should get a 'file notfound' message.<p/><p>Create a test file '/usr/local/apache/htdocs/test.jsp'</p><example>2 + 2 = <%= 2 + 2 %></example><p>Browse http://localhost/test.jsp again. You should now get:</p><results>2 + 2 = 4</results></s2><s2 title='Deploying on NT'><p>The Servlet Runner can be installed as an NT service.</p><p>To install the service, use</p><example>unix> resin-2.1.0/bin/httpd -install</example><p>To remove the service, use</p><example>unix> resin-2.1.0/bin/httpd -remove</example><p>You will either need to reboot the machine or start the servicefrom the Control Panel/Services panel to start the server. On amachine reboot, NT will automatically start the servlet runner.</p></s2></s1>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -