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.
The following steps will start Resin for development:
- Install JDK 1.4 or later and link /usr/java to the Java home or
set environment variable JAVA_HOME.
- tar -vzxf resin-3.0.0.tar.gz
- (Optional) Link /usr/local/resin to the resin-3.0.0 directory.
- ./configure; make; make install
- Execute resin-3.0.0/bin/httpd.sh
- Browse http://localhost:8080
Getting Started on Unix
unix> resin-3.0.x/bin/httpd.sh
Resin 3.0.0-beta (built Thu Feb 13 18:21:13 PST 2003)
Copyright(c) 1998-2002 Caucho Technology. All rights reserved.
Starting Resin on Sat, 01 Mar 2003 19:11:52 -0500 (EST)
[19:11:56.479] ServletServer[] starting
[19:11:57.000] Host[] starting
[19:11:58.312] Application[http://localhost:8380/doc] starting
[19:12:11.872] Application[http://localhost:8380/quercus] starting
...
[19:12:12.803]http listening to *:8380
[19:12:12.933]hmux listening to *:6802
|
--enable-64bit | Compiles the JNI using 64-bits
|
The 64-bit JNI compilation must match the JDK you're using, i.e.
you'll need to use something like "-J-d64" to properly enable 64 bit JDKs.
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/resin to the current Resin version. This is $RESIN_HOME.
- Create a deployment root, e.g. /usr/local/web, owned by
the resin user. This is $SERVER_ROOT.
- Put the modified resin.conf in /usr/local/web/conf/resin.conf
- Put the site documents in /usr/local/web/doc.
- Put any .war files in /usr/local/web/webapps.
- Output logs will appear in /usr/local/web/log.
- Create a startup script and configure the server to start it
when the machine reboots.
bin/httpd.sh uses a perl script, resin-3.0.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.
You can create your own starting script which will start and stop
your Resin instance, and will pass any command-line arguments. The script
will 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 SERVER_ROOT
- Select a server and pid file if you have multiple Resin servers.
- 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:
- Install JDK 1.4 or later.
- Make sure the JDK installation set the environment variable JAVA_HOME correctly
- Unzip resin-3.0.0.zip
- Execute resin-3.0.0/httpd.exe
- Browse http://localhost:8080
Starting on Win32
C:\win32> resin-3.0.0\bin\httpd
Resin 3.0.0-beta (built Thu Feb 13 18:21:13 PST 2003)
Copyright(c) 1998-2002 Caucho Technology. All rights reserved.
Starting Resin on Sat, 01 Mar 2003 19:11:52 -0500 (EST)
[19:11:56.479] ServletServer[] starting
[19:11:57.000] Host[] starting
[19:11:58.312] Application[http://localhost:8380/doc] starting
[19:12:11.872] Application[http://localhost:8380/quercus] starting
...
[19:12:12.803]http listening to *:8380
[19:12:12.933]hmux listening to *:6802
|
The Resin Web Server can be installed as an Windows service.
To install the service, use
C:\> resin-3.0.x\bin\httpd -install -conf conf/myconf.conf
|
To remove the service, use
C:\> 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, Windows 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-3.0.x\bin\httpd -install-as ResinA -conf 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. You can avoid that bug if the
JDK is started with -Xrs.
C:\> resin3.0.0/httpd.exe -install -Xrs
|
Argument | Meaning | Default |
-verbose | Show the Java environment before starting Resin. | off |
-conf xxx | Selects the Resin configuration file | conf/resin.conf
|
-java_home xxx | Sets the JDK (also recognizes the environment variable JAVA_HOME.) | A heuristic search
|
-resin_home xxx | Sets the Resin home directory (also recognizes the environment variable RESIN_HOME.) | The parent directory of wrapper.pl
|
-classpath xxx | Adds to the system classpath. | $CLASSPATH
|
-pid xxx | (Unix) With start or stop, sets the file
to save the process id. | resin.pid
|
-stdout xxx | Sets the file to save stdout messages. | log/stdout.log.
|
-stderr xxx | Sets the file to save stdout messages. | log/stderr.log.
|
-Dmy.foo=value | Sets a Java system property. | n/a
|
-Xxxx | Passes the -Xxxx command to the JDK. | n/a
|
-Jxxx | Passes xxx as a JDK argument. | n/a
|
-nojit | Disables 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 | (Windows) install Resin as a service (but doesn't automatically start.) | n/a
|
-install-as xxx | (Windows) install Resin as a named service (but doesn't automatically start.) | n/a
|
-remove | (Windows) install Resin as a service (but doesn't automatically start.) | n/a
|
-remove-as xxx | (Windows) remove Resin as a named service (but doesn't automatically start.) | n/a
|
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
|
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.resin.Resin and starting Resin looks like
the following, once you've properly configured the classpath:
unix> java -Dresin.home=/usr/resin \
-Djava.util.logging.manager=com.caucho.log.LogManagerImpl \
com.caucho.server.resin.Resin \
-conf conf/resin.conf
|
Copyright © 1998-2005 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark,
and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc. | |
|