Crazy knowledge base


Unix (including Linux and MacOS-X)
Getting Started
The following steps will start Resin for development:

Install JDK 1.5 or later and link /usr/java to your Java home or set environment variable JAVA_HOME.
tar -vzxf resin-3.2.0.tar.gz in /usr/local/share
(Optional) Link /usr/local/share/resin to the resin-3.2.0 directory.
./configure; make; make install
some ./configure options are available
Run java -jar resin/lib/resin.jar
Or run resin/bin/
Browse http://localhost:8080
Successful Foreground Startup Output
unix> java -jar resin/lib/resin.jar
Resin Professional 3.2.0 (built Wed, 06 Aug 2008 12:49:30 PDT)
Copyright(c) 1998-2008 Caucho Technology.  All rights reserved.

  001111.license – 1 Resin server Hogwarts School

Starting Resin on Thu, 07 Aug 2008 19:11:52 -0700 (PDT)

[21:22:21.282] Proxy Cache disk-size=1024M memory-size=8M
[21:22:21.477] Server[id=,cluster=app-tier] starting
[21:22:21.477] Mac OS X 10.4.7 ppc
[21:22:21.477] Java 1.5.0_06-64, 32, mixed mode, sharing, MacRoman, en, “Apple Computer, Inc.”
[21:22:21.477] resin.home = /usr/local/share/resin
[21:22:21.478] resin.root = /var/www
[21:22:21.492] Loaded Socket JNI library.
[21:22:21.595] hmux listening to localhost:6800
[21:22:21.696] http listening to *:8080
[21:22:21.842] Host[] starting
[21:22:22.089] WebApp[] starting
Deployment Directories
When deploying, it’s a good idea to create a bit of structure to make Resin and website upgrades easier and more maintainable.

Create a user to run Resin (e.g. resin or another non-root user)
Link /usr/local/share/resin to the current Resin directory. This is $RESIN_HOME.
Create a deployment root, e.g. /var/www, owned by the resin user. This is $RESIN_ROOT.
Put the modified resin.xml in /etc/resin/resin.conf
Put the site documents in /var/www/hosts/default/webapps/ROOT.
Put any .war files in /var/www/hosts/default/webapps.
Put any virtual hosts in /var/www/hosts/
Output logs will appear in /var/www/log.
Create a startup script and configure the server to start it when the machine reboots.
Startup Script
You can create your own startup script which will start and stop the ResinWatchdog, and will pass any command-line arguments. The script might typically do a number of things:

Configure the location of Java in JAVA_HOME
Configure the location of Resin in RESIN_HOME
Configure your web site directory in RESIN_ROOT
Select a server and pid file if you have multiple Resin servers.
Start and stop the ResinWatchdog.
The start script might look like:

Example script



export JAVA_HOME

$java -jar $RESIN_HOME/lib/resin.jar \
      -root-directory $RESIN_ROOT \
      -conf /etc/resin/resin.xml \
      -server a \
This script would be called as ./ start to start and ./ stop to stop.

The -server argument is only necessary if you have multiple servers (JVM instances) either on different machines or the same machine. The load balancing and distributed sessions pages describe when you might use -server.

More information on deploying on Unix is available on the Linux boot documentation.


Unix Installation
Resin needs Apache 1.3.x or greater and DSO support.

To configure Resin with Apache, you must follow the following steps:

Compile Apache
Configure Apache
Set up environment
Configure resin.xml
Restart Apache and start the backend Resin server
Compiling Apache
You need a version of Apache with DSO support enabled. Apache has full documentation at their website. To check if your apache has DSO support, you can check for mod_so.c in your your httpd

checking apache httpd for mod_so.c
unix> /usr/local/apache/bin/httpd -l
Compiled-in modules:
Many distributions, e.g. Red Hat Linux, will have Apache preinstalled. However, because the standard distribution has files all over the place, some people prefer to recompile Apache from scratch.

Once you untar Apache, build it like:

unix> ./configure –prefix=/usr/local/apache –enable-module=so
unix> make
unix> make install
Solaris versions of Apache may need additional flags, otherwise you’ll get some linking errors when trying to load Resin. You may need to refer to the Apache documentation if you get linking errors. Here’s an example configuration on Solaris:

unix> ./configure –prefix=/usr/local/apache \
                  –enable-rule=SHARED_CORE \
                  –enable-rule=SHARED_CHAIN \
                  –enable-module=so \
                  –enable-module=most \
To compile and install mod_caucho on Unix, you’ll need to run Resin’s configure and then make. This step will create and put it in the Apache module directory. Usually, will end up in /usr/local/apache/libexec/

If you know where your apxs executable is, you can use –with-apxs. apxs is a little Perl script that the Apache configuration makes. It lets modules like Resin know how all the Apache directories are configured. It is generally in /usr/local/apache/bin/apxs or /usr/sbin/apxs. It’s usually easiest to use –with-apxs so you don’t need to worry where all the Apache directories are.

unix> ./configure –with-apxs=/usr/local/apache/bin/apxs
unix> make
Even if you don’t know where apxs is, the configure script can often find it:

unix> ./configure –with-apxs
unix> make
As an alternative to –with-apxs, if you’ve compiled Apache yourself, or if you have a simple configuration, you can generally just point to the Apache directory:

unix> ./configure –with-apache=/usr/local/apache
unix> make
unix> make install
The previous –with-apxs or –with-apache should cover most configurations. For some unusual configurations, you can have finer control over each directory with the following arguments to ./configure. In general, you should use –with-apache or –with-apxs, but the other variables are there if you know what you’re doing.

–with-apache=dir The Apache root directory. 
–with-apxs=apxs Pointer to the Apache extension script 
–with-apache-include=dir The Apache include directory 
–with-apache-libexec=dir The Apache module directory 
–with-apache-conf=httpd.conf The Apache config file 

Configure the Environment
If you don’t already have Java installed, you’ll need to download a JDK and set some environment variables.

Here’s a typical environment that you might put in ~/.profile or /etc/profile

# Java Location
export JAVA_HOME

# Resin location (optional).  Usually Resin can figure this out.

# If you’re using additional class libraries, you’ll need to put them
# in the classpath.