caucho
Resin
FAQ
Reference Guide
JavaDoc
Demo
Tutorial

Getting Started
Configuration
EJB
Topics
JSP
XTP/XSL

Resin Web Server
Unix Apache
Windows Apache
Unix Netscape
IIS
WebSite
Other Servlets
 

Unix Apache
Getting Started
Unix Netscape

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

    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.2/srun/win32-1.3.6/mod_caucho.dll
    AddModule mod_caucho.c
    
    <IfModule mod_caucho.c>
      CauchoConfigFile <installdir>/resin1.2/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.

    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.2/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>
    
    In Resin 1.2, 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
    <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>
    

    When mod_caucho can't reach any JVM, it will send a default error page. Sites can customize the error page with the error-page directive in the resin.conf.
    resin.conf
    ...
    <web-app>
      <error-page exception-type='connection'
                  location='/conn_error_page.html'/>
      ...
    </web-app>
    
    By default, Resin will look in resin1.2/doc for JSP files and resin1.2/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>
    
    Now you need to start the servlet engine. From the resin1.2/bin folder, click on srun.

    > resin1.2/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'

    2 + 2 = <%= 2 + 2 %>
    

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

    2 + 2 = 4
    

    The Servlet Runner can be installed as an NT service.

    To install the service, use

    unix> resin1.2/bin/srun -install
    

    To remove the service, use

    unix> resin1.2/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
    Getting Started
    Unix Netscape
    Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
    Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.