Starting Resin

From Resin 3.0

Jump to: navigation, search

<document>

 <header>
   <product>resin</product>
   <version>Resin 3.0</version>
   <title>Resin Installation Quick Start</title>
   <description>

You can start using Resin by simply expanding the archive, and starting Resin with a Java command line.

   </description>
 </header>
 <body>
   <localtoc/>

<s1 name="quickstart" title="Quick Start for the Impatient">

The Resin web server starts listening to HTTP requests on port 8080 and listens on port 6800 for <a href="resin-clustering.xtp">load balancer</a> or cluster messages. Resin can then be used for development or evaluation. The steps are:

  1. Install JDK 1.5 or later.
    • On Unix, set the JAVA_HOME variable or link /usr/java to the java home.
    • On Windows, check to make sure the JDK installation sets JAVA_HOME correctly.
  2. unzip/untar the Resin download. It will unzip into resin-3.2.x/.
    • resin-3.2.x is resin.home, the location of the Resin distribution.
    • For now, it is also ${resin.root}, the location of your content. Soon, you will want to move ${resin.root} to something like /var/www.
  3. On Unix, execute use ./configure; make; make install
  4. Start in development mode java -jar resin-3.2.x/lib/resin.jar
  5. Browse http://localhost:8080

<s2 title="Adding Content">

Once you've made sure Resin is working, you'll want to add some content to the default web site:

  1. Add PHP files like resin-3.2.0/hosts/default/webapps/ROOT/hello.php.
  2. Add JSP files like resin-3.2.0/hosts/default/webapps/ROOT/hello.jsp.
  3. Add servlets like resin-3.2.0/hosts/default/webapps/ROOT/WEB-INF/classes/test/HelloServlet.java
    • Create a file resin-3.2.0/hosts/default/webapps/hello/WEB-INF/resin-web.xml to configure the servlet.
  4. Add .war files like resin-3.2.0/hosts/default/webapps/hello.war.
  5. Create web-apps directly like resin-3.2.0/hosts/default/webapps/hello/index.php The URL in your browser is http://localhost:8080/hello.
    • Create a file resin-3.2.0/hosts/default/webapps/hello/WEB-INF/resin-web.xml to configure the 'hello' web application.

</s2>

<s2 title="Virtual Hosts">

You can easily create <a href="virtual-host.xtp">virtual hosts</a> by creating content in the resin.root/hosts directory:

  1. Add a hello.php to resin-3.2.0/hosts/localhost/webapps/ROOT/hello.php

</s2>

<s2 title="Permanent content locations">

Eventually, you'll want to move your content and configuration into a more permanent location:

  1. Create a permanent resin.root:
    • Virtual hosts go in /var/www/hosts/www.foo.com/webapps/ROOT
    • Run java -jar resin-3.2.0/lib/resin.jar --root-directory /var/www
    • You can also set <root-directory> in the <<a href="cluster-tags.xtp#root-directory">cluster</a>> to configure the resin root.
  2. If needed, modify the Resin configuration in resin-3.2.0/conf/resin.xml
    • You can copy resin.xml to somewhere like /etc/resin/resin.xml
    • Run java -jar resin-3.2.0/lib/resin.jar --conf /etc/resin/resin.xml

</s2>

<s2 title="Running Resin as a daemon">

In a deployment environment, Resin will run as a background daemon. The previous steps ran Resin in the foreground, which is convenient for development since the logging output goes to the console. When running as a daemon, Resin detaches from the console and continues running until told to stop.

  1. Start resin with java -jar resin-3.2.0/lib/resin.jar start
  2. Stop resin with java -jar resin-3.2.0/lib/resin.jar stop
  3. Restart resin with java -jar resin-3.2.0/lib/resin.jar restart

</s2>

Until you're ready to deploy the server, those are all the steps needed to get started with Resin.

</s1>

<s1 title="Preconditions">

Resin 3.2 needs Java before it can run. It needs JDK 1.5 or a later JDK.

Sun's JDK for Windows, Solaris, and Linux can be found at <a href="http://java.sun.com">http://java.sun.com</a>. Sun also has links to some other ports of the JDK.

</s1>

<s1 title="Resin Web Server">

The easiest and fastest Resin configuration uses the Resin as the primary or only web server. This configuration provides a Java HTTP server. We recommend you start with this before trying any other configuration.

<figure src="httpd.gif"/>

The server listens at port 8080 in the default configuration and can be changed to the HTTP port 80 during deployment.

<s2 title="Windows">

  1. Install JDK 1.5 or later.
  2. Check that the environemnt variable JAVA_HOME is set to the JDK location, e.g. "c:\j2sdk1.5.0_01"
  3. Unzip resin-3.2.0.zip
  4. Define the environment variable RESIN_HOME to the location of Resin, for example "c:\resin-3.2.0"
  5. Execute java -jar resin-3.2.0/lib/resin.jar
  6. Browse http://localhost:8080

</s2>

<s2 title="Unix (including MacOS-X)">

  1. Install JDK 1.5 or later and link /usr/java to the Java home or define the environment variable JAVA_HOME.
  2. tar -vzxf resin-3.2.0.tar.gz
  3. cd resin-3.2.0
  4. ./configure
  5. make
  6. make install
  7. Execute java -jar resin-3.2.0/lib/resin.jar
  8. Browse http://localhost:8080

</s2>

For more details, see the <a href="resin-web-server.xtp">Resin Web Server</a> configuration page.

</s1>

<s1 title="Resin with Apache">

If you are already using Apache for your web server, you can use Resin with Apache. This configuration uses Apache to serve html, images, PHP, or Perl, and Resin to serve JSPs and Servlets.

The Apache configuration uses two pieces: a C program extending Apache (mod_caucho) and Java program supporting servlets and JSP (srun.) The two pieces communicate with a special high-speed protocol.

<figure src="apache_srun.gif"/>

To configure Apache with Resin, you must configure both Apache and Resin. The Resin configuration is identical to Resin's httpd configuration. The Apache configuration tells Apache how to find Resin.

  1. On Unix only, compile mod_caucho.so using ./configure --with-apache; make
  2. Make any needed Apache httpd.conf changes
  3. Make any needed Resin resin.xml changes
  4. Restart Apache
  5. Start Resin with resin-3.2.0/bin/resin.sh on Unix or resin-3.2.0/resin.exe on Windows.

On Unix, you'll run configure using --with-apache and then make:

<example> unix> ./configure --with-apache=/usr/local/apache unix> make unix> make install </example>

For more details, see the <a href="install-apache.xtp">Resin with Apache</a> configuration page.

</s1>

<s1 title="Resin with IIS">

You can also combine IIS and Resin. IIS serves static content like html and images and Resin serves JSPs and Servlets. The IIS configuration requires two pieces: isapi_srun.dll, an ISAPI extension which lets IIS talk to Resin, and srun, Resin's Java support.

<figure src="iis_srun.gif"/>

For this setup you must configure both IIS and Resin. The Resin configuration to run with IIS is identical to Resin's standalone configuration. The IIS configuration tells IIS how to find Resin.

  1. Setup the registry and IIS using resin-3.2.0/setup.exe
  2. Any needed Resin resin.xml changes
  3. Restart IIS
  4. Start Resin with resin-3.2.0/resin.exe.

For more details and troubleshooting steps, see the <a href="install-iis.xtp">Resin with IIS</a> configuration page.

</s1>

</body> </document>

Personal tools