Providing geoscience data globally oneGeology logo Navigation
Main content
Bottom links

OneGeology

Home > How to serve a OneGeology WMS > Setting up a MapServer WMS > Install MapServer on LAMP > Configuring exemplars

4.4.2.1 Configuring MapServer exemplar services on a LAMP server

We shall now configure the two BGS exemplar services (a shapefile version and a raster version) available from the BGS FTP server.

#cd /usr/local/src
#wget ftp://ftp.bgs.ac.uk/pubload/OneGeology/1G_WMS-exemplar-data-MS6-update.zip
#unzip 1G_WMS-exemplar-data-MS6-update.zip

We now need to move the contents of the zip file to the correct locations on our server.

First we move our index pages to the root directory of the web server (/var/www/ on Ubuntu).

#mv ms4w/Apache/htdocs/* /var/www/

Create Alias configuration files

Next we need to create an alias to our data files and MapServer html templates. The way you do this varies considerably depending on your Linux version. In older versions of Ubuntu these aliases are created in the alias file located in the /etc/apache2/conf.d/ directory. In recent versions you should add these aliases to the httpd.conf file in /etc/apache2/

We need to create information in the style of the contents of the .conf files (found in our unzipped contents ../ms4w/httpd.d/ directory). We will combine the contents of both .conf files (that deal with the html templates and data content) into our ‘alias’ configuration file.

You may choose any text editor, but probably the easiest to use is nano.

#cd /etc/apache2
#nano httpd.conf

Alias /BGS_Bedrock_Geology
/usr/local/src/ms4w/apps/cookbookExemplars/BGS_Bedrock_Raster_Map/wwwroot/

<Directory /usr/local/src/ms4w/apps/cookbookExemplars/BGS_Bedrock_Raster_Map/wwwroot/>
AllowOverride None
Options Indexes FollowSymLinks Multiviews
Order allow,deny
Allow from all
</Directory>

Alias /BGS_Bedrock_and_Superficial_Geology
/usr/local/src/ms4w/apps/cookbookExemplars/BGS_Bedrock_and_Superficial_Geology/wwwroot/

<Directory /usr/local/src/ms4w/apps/cookbookExemplars/BGS_Bedrock_and_Superficial_Geology/wwwroot/>
AllowOverride None
Options Indexes FollowSymLinks Multiviews
Order allow,deny
Allow from all
</Directory>

^O (to save changes)

ENTER

^X (to exit)

You will probably need to restart the Apache web server at this point:

#/etc/init.d/apache2 restart

We can test these using the lynx browser

#lynx http://127.0.0.1/BGS_Bedrock_and_Superficial_Geology/index.html

or using wget:

#cd /tmp
#wget http://127.0.0.1/BGS_Bedrock_Geology/index.html
#less index.html

Create a wms shell script

Next we need to create a ‘wms’ shell script for each of our Map Services; which we need to place in an associated directory.

#cd /usr/lib/cgi-bin
#mkdir --parents exemplars/BGS_Bedrock_Geology
#nano exemplars/BGS_Bedrock_Geology/wms

#!/bin/sh
MS_map file=/usr/local/src/ms4w/apps/cookbookExemplars/BGS_Bedrock_Raster_Map/onegeology.map
export MS_map file
exec /usr/lib/cgi-bin/mapserv
exit 0

^O (to save changes)

ENTER

^X (to exit)

#chmod 755 exemplars/BGS_Bedrock_Geology_Raster/wms

and similarly for our shapefile based service

#mkdir --parents exemplars/BGS_Bedrock_and_Superficial_Geology
#nano exemplars/BGS_Bedrock_and_Superficial_Geology/wms

#!/bin/sh
MS_map file=/usr/local/src/ms4w/apps/cookbookExemplars/BGS_Bedrock_and_Superficial_Geology/onegeology.map
export MS_map file
exec /usr/lib/cgi-bin/mapserv
exit 0

^O (to save changes)

ENTER

^X (to exit)

#chmod 755 exemplars/BGS_Bedrock_and_Superficial_Geology/wms

Modify paths in the map file

The final step is to modify the WEB > IMAGEPATH path (to "/var/tmp/") and the WEB > IMAGEURL path (to "/tmp/") in each of our onegeology.map files

That’s it!

Section last modified: 12 June 2013

Back|Next

OneGeology © 2014. This site is hosted by the British Geological Survey but responsibility for the content of the site lies with OneGeology not with the British Geological Survey. Questions, suggestions or comments regarding the contents of this site should be directed to the OneGeology secretariat.