5

I want to install MapServer and MapCache on Ubuntu 14.04. The MapServer installation succeeded but now I'm stuck with the installation of MapCache. This is what I did so far:

Install MapServer and MapCache:

sudo apt-get install cgi-mapserver mapcache-cgi libapache2-mod-mapcache

Store my raster images in /mapserver/data/tamale_2014ds.tif and tamale_2014ws.tif and create a map file in /mapserver/tamale.map:

MAP
  PROJECTION
   "init=epsg:3857"
  END  
  IMAGETYPE      JPEG
  EXTENT         -94018 1048833 -92362 1049470
  SIZE           1000 400
  WEB
    METADATA
      "wms_title" "tamale"
  "wms_srs" "epsg:3857"
    END
  END
  LAYER
    METADATA
      "wms_title" "dry_season_2014"
      "wms_srs" "epsg:3857"
      "wms_enable_request" "*"
    END
    NAME         dry_season_2014
    DATA         /mapserver/data/tamale_2014ds.tif
    STATUS       OFF
    TYPE         RASTER
    PROCESSING   "BANDS=1,2,3"
    OFFSITE      0 0 0
  END 
  LAYER
    METADATA
      "wms_title" "wet_season_2014"
      "wms_srs" "epsg:3857"
      "wms_enable_request" "*"
    END
    NAME         wet_season_2014
    DATA         /mapserver/data/tamale_2014ws.tif
    STATUS       OFF
    TYPE         RASTER
    PROCESSING   "BANDS=1,2,3"
    OFFSITE      0 0 0
  END 
END

So far, everything is fine, see OpenLayers demo: http://geocre.net/mapservertest/ (code)

For MapCache I edited my apache configuration file /etc/apache2/sites-available:

<IfModule mapcache_module>
   <Directory /mapcache>
      Order Allow,Deny
      Allow from all
   </Directory>
   MapCacheAlias /mapcache "/mapcache/mapcache.xml"
</IfModule>

However, I cannot access MapCache. All I get is a status 403 Forbidden: http://78.47.251.2/mapcache

I already tried several owners and permissions for the directory /mapcache (even CHMOD 777). Any ideas on that?

4

OK, I think I found it: As I'm running Apache 2.4.7, the Apache configuration needs to look like this (see here):

<IfModule mapcache_module>
   <Directory /mapcache>
      Require all granted
   </Directory>
   MapCacheAlias /mapcache "/mapcache/mapcache.xml"
</IfModule>

The MapCache request URL is then http://78.47.251.2/mapcache/?. In OpenLayers, it is accessible like this:

var rasterLayer = new OpenLayers.Layer.WMS("Tamale (2014 WS)", "http://78.47.251.2/mapcache/?", {layers: 'tamale'} );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.