Sun One Reverse Proxy to Tomcat

From EggeWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The goal of this exercise is to get a Sun One 6.1 Web Server configured as a reverse proxy, forwarding certain requests to the app server, running Apache Tomcat 6.0.14.

First, I need to install Tomcat. I've downloaded it to my install directory.

<geshi lang="bash"> $ cd install/ $ gunzip apache-tomcat-6.0.14.tar.gz $ tar xvf apache-tomcat-6.0.14.tar $ mv apache-tomcat-6.0.14 ../ $ cd .. $ ln -s apache-tomcat-6.0.14 tomcat $ tomcat/bin/startup.sh

  1. I'll add this to my .bashrc later

$ export JAVA_HOME=/usr/java $ tomcat/bin/startup.sh Using CATALINA_BASE: /export/home/begge1/apache-tomcat-6.0.14 Using CATALINA_HOME: /export/home/begge1/apache-tomcat-6.0.14 Using CATALINA_TMPDIR: /export/home/begge1/apache-tomcat-6.0.14/temp Using JRE_HOME: /usr/java </geshi>

I'm going to copy some files over from box1, so I'll have something to look at once I get it working <geshi lang="bash"> $ rsync -avz build/reports/cobertura box2:~/tomcat/webapps/ROOT/ </geshi>

A quick check of http://box2:8080/cobertura/ in the browser shows everything is working well.

Next, I need to configure my Sun ONE web server. Fortunately, there's a good guide for this. This seems to be a more useful guide.


Hint to reset the password to blank. I ended not really using the admin console. <geshi lang="bash"> $ diff admpw.bak admpw 1c1 < admin:{SHA}Ngim0aBauiPqOQ5fO0ggPbtyQfc= \ No newline at end of file --- > admin: </geshi>

I made these changes to the config files <geshi lang="diff"> diff -u WebServer6.1.orig/https-myserver/config/magnus.conf WebServer6.1/https-myserver/config/magnus.conf --- WebServer6.1.orig/https-myserver/config/magnus.conf 2007-10-31 16:32:12.903619200 +1100 +++ WebServer6.1/https-myserver/config/magnus.conf 2007-10-31 17:15:50.724017300 +1100 @@ -17,3 +17,6 @@

+ +# reverse proxy module +Init fn="load-modules" shlib="C:/Sun/WebServer6.1/plugins/passthrough/passthrough.dll" diff -u WebServer6.1.orig/https-myserver/config/obj.conf WebServer6.1/https-myserver/config/obj.conf --- WebServer6.1.orig/https-myserver/config/obj.conf 2007-10-31 16:32:13.059876200 +1100 +++ WebServer6.1/https-myserver/config/obj.conf 2007-10-31 17:33:47.115987500 +1100 @@ -5,6 +5,7 @@

# problems. See the documentation for more information.

<Object name="default">

+NameTrans fn="assign-name" from="/cobertura(|/*)" name="box2"

NameTrans fn="ntrans-j2ee" name="j2ee"
NameTrans fn="pfx2dir" from="/mc-icons" dir="C:/Sun/WebServer61/ns-icons" name="es-internal"
NameTrans fn="document-root" root="$docroot"

@@ -45,11 +46,15 @@

Output fn="insert-filter" filter="http-compression"
</Object>

+# Execute these instructions for any resource with the assigned name +# "box2" +<Object name="box2"> + +# Proxy the requested resource to the URL + +Service fn="service-passthrough" + servers="http://box2:8080/cobertura" + +</Object> \ No newline at end of file

</geshi>