Monday, 23 April 2012

Geoserver, Tomcat, Openlayers

A mini guide to setting up geoserver using Tomcat on IIS (7)

some versions:
IIS 7
Windows 7 64 bit
Apache Tomcat 7.0.27
Geoserver:
Build Information
Version 2.1.3
Subversion Revision 16668
Build Date 21-Dec-2011 11:55
GeoTools Version 2.7.4 (rev 38443)
JRE: 6

1.      Download and install Tomcat from Apache (http://tomcat.apache.org/download-60.cgi) I installed the 64 bit version as above.
2.      I used this guide on Apache website (http://tomcat.apache.org/tomcat-7.0-doc/setup.html#Windows).  You can use the installer or just unzip to folder and add the env variables CATALINA_HOME (to the root install of Tomcat) and JAVA_HOME and JRE_HOME (to point at Java install).
3.      Install the ISAPI connector for IIS - now I could not get this to work at all - I would get different errors depending on whether I used the 32 bit or 64 bit and there was lots of traffic on the web about it.  I tried most things and gave up.
4.      Instead I installed the  The BonCode AJP (Apache JServ Protocol version 1.3) Connector  from these guys ( http://tomcatiis.riaforge.org/).  Installer worked first time and copies 2 Dlls to the bin folder of website folder (inetpub on IIS).  Default install intercepts all traffic.  Uses .NET 3.5
5.      Set up handlers (or rather the install does this for you)
6.      Check Tomcat is running OK at http://localhost:8080/ and try any of the sample jsp pages to check all OK.  You'll get an error messsage if not.
7.      Download the Geoserver WAR file from www.geoserver.org at (Instructions here: http://docs.geoserver.org/stable/en/user/installation/war.html).  Remember to add
<role rolename="manager-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui"/>
to the tomcat-users.xml file in the conf directory so that you have access to the Manager app.  Install the webapp by selecting it in the manager app as per the instructions in the link above.
8.      Download the URL REWRITE addin for IIS (http://www.iis.net/download/URLRewrite)
This is so that we can omit the port number and redirect all geoserver calls correctly but allow IIS to function normally (as our web service is running here as well).
9.      Create an inbound rule in URL rewrite that redirects all traffic to localhost/8080 so that geoserver can be accessed directly

10.    Add a condition to the rule so that anything to other directories (or whatever) is not redirected


11.    Test the rules work by trying to access:
http://localhost/geoserver (should be redirected)
http://localhost/dev (should not be redirected) as in this example this is where our web service sits.
12.    Add a workspace and some data to Geoserver and publish it
13.    Create an Openlayers page to access it and all should be hunky dory
The OpenLayers code will be in the next post.

No comments:

Post a Comment