Resin Web Server on Unix or Windows |
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:
- Install JDK 1.2 or later and link /usr/java to the Java home.
- tar -vzxf resin-2.1.0.tar.gz
- (Optional) Link /usr/local/resin to the resin-2.1.0 directory.
- Execute resin-2.1.0/bin/httpd.sh
- 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.
- Create a user to run Resin (e.g. resin or another non-root user)
- Compile the bin/resin program.
- 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/resin and bin/httpd.sh
bin/resin is an alternative launching program which binds
to port 80 for HTTP and port 443 for SSL as root, and changes the
user id to something safer, like "resin" or "web", to execute servlets.
bin/resin can also use OpenSSL for fast
SSL support.
The ./configure; make process will build a bin/resin
executable.
resin-2.1.0> ./configure
resin-2.1.0> make
resin-2.1.0> make install
|
If bin/resin is not available on your Unix version, you can
use bin/httpd.sh with the same arguments. bin/httpd.sh will not
switch from root or allow OpenSSL, but otherwise
the two are equivalent. To use the
user-name and
group-name directives, you
must use bin/resin.
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/resin or 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:
- 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/resin -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. If bin/resin is unavailable,
use bin/httpd.sh instead.
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:
Getting Started
- Install JDK 1.2 or later.
- Unzip resin-2.1.0.zip
- Execute resin-2.1.0/bin/httpd
- 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
|
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 | (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
|
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
|
Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark,
and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc. | |
|