|
|
Caucho Servlet Engine on Apache Unix
|
Resin provides a fast servlet runner for Apache, allowing Apache
to run servlets and JSP files. The servlet runner needs Apache 1.3.x
and DSO support.
To configure Resin with Apache, you must follow the following steps:
- Getting Apache binaries
- Getting mod_caucho binaries
- Configure Apache
- Set up environment
- Configure resin.conf
- Restart Apache and start srun
Getting Apache binaries
You need a OS/2 version of Apache with DSO support enabled.
You can get it from http://apache.org/~bjh/apache2/.
Getting mod_caucho binaries
mod_caucho for OS/2 included in this distribution. You can get caucho.dll from
srun/os2-1.3.12/ directory.
Configuring Apache by hand
You must change httpd.conf file. Here are the changes:
httpd.conf
LoadModule caucho_module libexec/caucho.dll
<IfModule mod_caucho.c>
CauchoConfigFile <installdir>/resin1.1/conf/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.
Restart Apache. Now browse http://localhost/caucho-status. It
should return a table indicating that the servlet runner is stopped.
Browse http://localhost/test.jsp. It should return a message like:
Cannot connect to Servlet Runner.
|
caucho-status |
Handler to display /caucho-status
|
caucho-request |
Handler to connect to srun
|
Configure the Environment
If you don't already have Java installed, you'll need to download a
JDK and set some environment variables. OS/2 JDKs are available at
and at
IBM.
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 '/apache/htdocs'.
resin.conf
<caucho.com>
<http-server
app-dir='/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>
|
Starting the Servlet Engine
Now you need to start the servlet engine.
Testing the servlet engine
Create a test file '/apache/htdocs/test.jsp'
<%@ page language=javascript %>
2 + 2 = <%= 2 + 2 %>
|
Browse http://localhost/test.jsp again. You should now get
Troubleshooting
First, check your configuration with the standalone httpd.sh.
Both httpd.sh and srun.sh use the same configuration file, so the
results should be identical.
Check http://localhost:8080/caucho-status. That will tell if
mod_caucho has properly read the resin.conf.
- If caucho-status fails entirely, the problem is in the mod_caucho
installation and the Apache httpd.conf.
- If caucho-status shows the wrong mappings, there's something wrong
with the resin.conf or the pointer to resin.conf in httpd.conf.
- If caucho-status shows a red servlet runner, then srun.cmd hasn't
properly started.
- If you get a "cannot connect to servlet engine", caucho-status
will show red, and srun.cmd hasn't started properly.
- If srun.cmd doesn't start properly, you should look at the logs
in resin1.1/log. You should start srun.cmd -verbose to get
more information.
- If you get Resin's file not found, the Apache configuration
is good but the resin.conf probably points to the wrong directories.
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.
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 host='host1' port='6802'/>
<srun host='host2' port='6802'/>
<srun-backup 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
CauchoErrorPage directive.
httpd.conf
CauchoErrorPage /apache/htdocs/resin_error_page.html
|
OS/2 port by Eugen Kuleshov.
Copyright © 1998-2000 Caucho Technology. All rights reserved.
Last modified: Fri, 03 Mar 2000 18:23:40 -0800 (PST)
|