caucho
Resin
FAQ
Reference Guide
Demo
Tutorial

Getting Started
Configuration
IDE
Topics
JSP
XML/XSLT

Resin Web Server
Unix Apache
Windows Apache
Unix Netscape
IIS
WebSite
 Resin Web Server on Unix or Windows

Getting Started
Getting Started
Unix Apache

  1. Unix (including Linux and MacOS-X)
    1. Getting Started
    2. Deploying on Unix
    3. OpenSSL and JNI
    4. Starting Script
  2. Windows
    1. Getting Started
    2. Deploying as an NT Service
  3. Command-line arguments
    1. Memory Configuration
  4. Starting Java directly

Resin provides a fast standalone web server. In our benchmarks, it serves static pages faster than Apache! For many sites, the standalone web server is ideal because of its performance and because it is easier to configure and maintain than using a separate web server.

Unix (including Linux and MacOS-X)

Getting Started

The following steps will start Resin for development:

  1. Install JDK 1.2 or later and link /usr/java to the Java home.
  2. tar -vzxf resin-2.1.0.tar.gz
  3. (Optional) Link /usr/local/resin to the resin-2.1.0 directory.
  4. Execute resin-2.1.0/bin/httpd.sh
  5. Browse http://localhost:8080
Getting Started on Unix
unix> resin-2.1.x/bin/httpd.sh
Resin 2.1.0 (built Mar 15 21:36:18 PDT 2002)
Copyright(c) 1998-2002 Caucho Technology.  All rights reserved.

Starting Resin on Fri, 15 Mar 2002 14:49:22 -0700 (PDT)
[2002-03-15 14:49:57.177] initializing application http://localhost:8080/examples/login
[2002-03-15 14:49:57.178] initializing application http://localhost:8080/jsp-tests
[2002-03-15 14:49:58.472] initializing application http://localhost:8080/examples/tags
[2002-03-15 14:49:58.473] initializing application http://localhost:8080/examples/templates
[2002-03-15 14:49:58.473] initializing application http://localhost:8080/examples/xsl
http listening to *:8080
srun listening to localhost:6802

Deploying on Unix

When deploying, it's a good idea to create a bit of structure to make Resin and website upgrades easier and more maintainable.

  1. Create a user to run Resin (e.g. resin or another non-root user)
  2. Link /usr/local/resin to the current Resin version. This is $RESIN_HOME.
  3. Create a deployment root, e.g. /usr/local/web, owned by the resin user. This is $SERVER_ROOT.
  4. Put the modified resin.conf in /usr/local/web/conf/resin.conf
  5. Put the site documents in /usr/local/web/doc.
  6. Put any .war files in /usr/local/web/webapps.
  7. Output logs will appear in /usr/local/web/log.
  8. Create a startup script and configure the server to start it when the machine reboots.

OpenSSL and JNI

OpenSSL support requires Resin's JNI code to be completed. The ./configure; make process will build the JNI modules in libexec.

resin-2.1.0> ./configure
resin-2.1.0> make
resin-2.1.0> make install

bin/httpd.sh uses a perl script, resin-2.1.0/bin/wrapper.pl, to control the Java process. (bin/httpd.sh is a tiny shell script that calls wrapper.pl.) You can modify bin/httpd.sh

If you need to stop Resin with kill, you'll need to kill the wrapper.pl process to make sure it doesn't restart Resin. ("httpd.sh stop" works by killing the wrapper.pl process.) or bin/wrapper.pl for your configuration.

In a production environment, the "start" and "stop" arguments to bin/httpd.sh will start and stop Resin as a Unix daemon for extra reliability. If Resin should ever exit, it will automatically be restarted.

Starting Script

The starting script will start and stop your Resin instance, and will pass any command-line arguments to Resin. The script will typically do a number of things:

  1. Configure the location of Java in JAVA_HOME
  2. Configure the location of Resin in RESIN_HOME
  3. Configure your web site directory in SERVER_ROOT
  4. Select a server and pid file if you have multiple Resin servers.
  5. Start and stop the Resin daemon.

The start script might look like:

Example start.sh script
#!/bin/sh

JAVA_HOME=/usr/java
RESIN_HOME=/usr/local/resin
SERVER_ROOT=/usr/local/web

export JAVA_HOME
export RESIN_HOME
export SERVER_ROOT

$RESIN_HOME/bin/httpd.sh -server-root $SERVER_ROOT \
                      -conf $SERVER_ROOT/conf/resin.conf \
                      -server a -pid $SERVER_ROOT/a.pid \
                      $*

The script would be called as "./start.sh start" to start and "./start.sh stop" to stop.

The -server and -pid arguments are only necessary if you have multiple JVMs either on different machines or the same machine. The load balancing and distributed sessions pages describe when you might use -server and -pid.

More information on deploying on Unix is available at:

Windows

Getting Started

  1. Install JDK 1.2 or later.
  2. Unzip resin-2.1.0.zip
  3. Execute resin-2.1.0/bin/httpd
  4. Browse http://localhost:8080
Starting on Win32
c:\win32> resin1.2\bin\httpd
Resin 2.0.s010831 (built Fri Aug 31 21:36:18 PDT 2001)
Copyright(c) 1998-2001 Caucho Technology.  All rights reserved.

Starting Resin on Mon, 03 Sep 2001 19:15:22 -0700 (PDT)
http listening to *:8080
srun listening to localhost:6802

Deploying as an NT Service

The Resin Web Server can be installed as an NT service.

To install the service, use

c:\> resin-2.1.x\bin\httpd -install -conf/myconf.conf

To remove the service, use

c:\> resin-2.1.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 web server.

You can also start and stop the service from the command-line:

c:\> net start resin
...
c:\> net stop resin

Resin's -install saves the command-line arguments and starts the service with those arguments. You can look at them in the control panel, under the executable string.

With multiple servers, you can use -install-as foo to specify the service name.

c:\> resin-2.0.x\bin\httpd -install-as ResinA -conf/myconf.conf -server a
c:\> net start ResinA

Note: There is a bug in many JDKs which cause the JDK to exit when the administrator logs out. JDK 1.3 and later can avoid that bug if the JDK is started with -Xrs.

dos> resin2.0/bin/httpd -install -Xrs

Command-line arguments

ArgumentMeaningDefault
-verboseShow the Java environment before starting Resin.off
-conf xxxSelects the Resin configuration fileconf/resin.conf
-java_home xxxSets the JDK (also recognizes the environment variable JAVA_HOME.)A heuristic search
-resin_home xxxSets the Resin home directory (also recognizes the environment variable RESIN_HOME.)The parent directory of wrapper.pl
-classpath xxxAdds to the system classpath.$CLASSPATH
-pid xxx(Unix) With start or stop, sets the file to save the process id.resin.pid
-stdout xxxSets the file to save stdout messages.log/stdout.log.
-stderr xxxSets the file to save stdout messages.log/stderr.log.
-Dmy.foo=valueSets a Java system property.n/a
-XxxxPasses the -Xxxx command to the JDK.n/a
-JxxxPasses xxx as a JDK argument.n/a
-nojitDisables the Just-In-Time compiler. Useful for debugging.enabled
start(Unix) Starts Resin as a daemon, saving the pid in the pid file.n/a
stop(Unix) Stops Resin as a daemon, using the pid in the pid file.n/a
restart(Unix) Restarts Resin as a daemon, using the pid in the pid file.n/a
-install(NT) install Resin as a service (but doesn't automatically start.)n/a
-install-as xxx(NT) install Resin as a named service (but doesn't automatically start.)n/a
-remove(NT) install Resin as a service (but doesn't automatically start.)n/a
-remove-as xxx(NT) remove Resin as a named service (but doesn't automatically start.)n/a

Memory Configuration

Memory configuration is part of the JVM's arguments. For most JVMs, you can find the full list by starting "java -X".

Memory Configuration
-Xms<size>Initial Java heap size, e.g. -Xms32m
-Xmx<size>Maximum Java heap size, e.g. -Xmx128m

Starting Java directly

You can use the -verbose flag to see the arguments the startup scripts/executables pass to the JDK. The main Java executable is com.caucho.server.http.HttpServer and starting Resin looks like the following, once you've properly configured the classpath:

unix> java -Dresin.home=/usr/resin \
           com.caucho.server.http.HttpServer \
           -conf conf/resin.conf 


Getting Started
Getting Started
Unix Apache
Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.