Resin with Apache on Windows
Resin 3.0

Orientation
Features
Installation
Configuration
Web Applications
JSP
Servlets and Filters
Portlets
Databases
Admin (JMX)
Amber
Security
XML and XSLT
XTP
Resources
Performance
Protocols
Third-party
Troubleshooting/FAQ

Quick Start
Standalone Web Server
Apache on Unix
Apache on Windows
IIS
Details
FAQ
Scrapbook
Apache on Unix
Installation
IIS

Resin provides a fast servlet runner for Apache, allowing Apache to run servlets and JSP files.

If you have not yet done so, we suggest you use the Resin standalone web server option first.

  1. Configuring Apache
    1. Alternate Apache Configuration
    2. Dispatching
  2. Load Balancing
  3. Configuring resin.conf
  4. Testing the servlet engine
  5. 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>/resin-3.0.x/libexec/apache-2.0/mod_caucho.dll

<IfModule mod_caucho.c>
  ResinConfigServer localhost 6802
  <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 mod_caucho read the configuration from the resin.conf file. If you use this method, you need ensure the Apache configuration matches the Resin configuration.

httpd.conf
LoadModule caucho_module <installdir>/resin-3.0.x/libexec/apache-2.0/mod_caucho.dll

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

Apache CommandMeaning
ResinConfigServer host portAdds the Resin JVM at host:port as a the configuration server.
CauchoStatus true/falseEnables/disables the /caucho-status management

Dispatching

mod_caucho selects URLs specified by the servlet-mapping directives to go to Resin. Other URLs stay with Apache. There's a more complete discussion of the URL dispatching in the plugin-dispatch tutorial.

Load BalancingResin 1.2

In Resin 3.0, 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.

In addition, you can specify backup machines. The backup only will serve requests if all primaries are down.

See the http config section for more details.

resin.conf
<resin xmlns="http://caucho.com/ns/resin">
<server>
  <cluster>
    <srun id="a" host="host1" port="6802" index="1"/>
    <srun id="b" host="host2" port="6802" index="2"/>
    <srun id="c" host="backup" port="6802" index="3" backup="true"/>
  ...
</server>
</resin>

Configuring resin.conf

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

resin.conf
<resin xmlns="http://caucho.com/ns/resin">
<server>
  <host id="">
    <document-directory>/usr/local/apache/htdocs</document-directory>

    ...
  </host>
</server>
</resin>

Testing the servlet engine

Now you need to start the servlet engine. From the resin-2.1.0/bin folder, click on srun.

> resin-3.0.x/bin/httpd

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

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

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> resin-3.0.x/bin/httpd -install

To remove the service, use

unix> resin-3.0.x/bin/httpd -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.


Apache on Unix
Installation
IIS
Copyright © 1998-2003 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.