caucho
Resin 1.1
FAQ
Reference
JavaDoc
Demo
Java Tutorial

Getting Started
Configuration
Servlet
JSP
XTP/XSL
JavaScript
JS Library

Resin Web Server
Unix Apache
Windows Apache
Unix Netscape
IIS
Other Servlets
 Caucho Servlet Engine on Apache Windows

Resin provides a fast servlet runner for Apache, allowing Apache to run servlets and JSP files.
  1. Configuring Apache
    1. Alternate Apache Configuration
    2. Load Balancing
    3. Connection Reuse
    4. Error Page
  2. Configuring resin.conf
  3. Testing the servlet engine
  4. Deploying on NT

Configuring Apache

To configure Apache to load the Caucho Server Runner, add the following lines to the Apache httpd.conf file:

httpd.conf
LoadModule caucho_module <installdir>/resin1.1/srun/win32-1.3.6/mod_caucho.dll
AddModule mod_caucho.c

<IfModule mod_caucho.c>
  CauchoConfigFile <installdir>/resin1.1/resin.conf
  <Location /caucho-status>
    SetHandler caucho-status
  </Location>
</IfModule>

Note: The caucho-status is optional and probably should be avoided in a production site. It lets you ask the Caucho Apache module about the Caucho status, valuable for debugging.

Alternate Apache Configuration

You can also configure Apache directly, instead of letting Caucho read configuration from the resin.conf file. If you use this method, you need to make sure you match the Apache configuration with the Resin configuration.
httpd.conf
LoadModule caucho_module <installdir>/resin1.1/srun/win32-1.3.6/mod_caucho.dll
AddModule mod_caucho.c

CauchoHost localhost 6802
AddHandler caucho-request jsp
<Location /servlet/*>
   SetHandler caucho-request
</Location>

Load Balancing

In Resin 1.1, you can distribute requests to multiple machines. All requests in a session will go to the same host. In addition, if one host goes down, Resin will send the request to the next available machine.
httpd.conf
CauchoHost host1 6802
CauchoHost host2 6803
CauchoHost host3 6804

Connection Reuse

Connection reuse is not yet available on Windows.

Error Page

When mod_caucho can't reach any JVM, it will send a default error page. Sites can customize the error page with the CauchoErrorPage directive.
httpd.conf
CauchoErrorPage /usr/local/apache/htdocs/resin_error_page.html

Configuring resin.conf

By default, Resin will look in resin1.1/doc for JSP files and resin1.1/doc/WEB-INF/classes for servlets and beans. To tell Resin to use Apache's document area, you configure the app-dir. Change app-dir from 'doc' to something like '/usr/local/apache/htdocs'.

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>

Testing the servlet engine

Now you need to start the servlet engine. From the resin1.1/bin folder, click on srun.

> resin1.1/bin/srun

Now browse http://localhost/test.jsp. You should get a 'file not found' message.

Create a test file '/usr/local/apache/htdocs/test.jsp'

<%@ page language=javascript %>
2 + 2 = <%= 2 + 2 %>

Browse http://localhost/test.jsp again. You should now get

2 + 2 = 4

Deploying on NT

The Servlet Runner can be installed as an NT service.

To install the service, use

unix> resin1.1/bin/srun -install

To remove the service, use

unix> resin1.1/bin/srun -remove

You will either need to reboot the machine or start the service from the Control Panel/Services panel to start the server. On a machine reboot, NT will automatically start the servlet runner.


Unix Apache   Unix Netscape
Copyright © 1998-2000 Caucho Technology. All rights reserved.
Last modified: Thu, 17 Feb 2000 11:14:35 -0800 (PST)