I want to do tile caching for MapServer map files by using TileCache application. For this I have installed Python 2.7 and TileCache 2.11 and applied the following sequence of steps:
- Extracted TileCache-2.11 tar file to my apache web directory into a folder tilecache Changed Disk Cache location in tilecache.cfg to my local folder
- Replaced name, srs, url with my map file in place of basic layer
- tested in browser using the url http://localhost:8088/tilecache/tilecache.cgi?LAYERS=APdem&&SERVICE=WMS&FORMAT=image/png&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&BBOX=-180,-90,0,90
But i'm getting tilecache.cfg python code in the browser as:
from TileCache import Service, cgiHandler, cfgfiles
if __name__ == '__main__':
svc = Service.load("tilecache.cfg")
cgiHandler(svc)
Is there any step missed in my process or what went wrong? In Linux the apache httpd.conf file is as follows
ServerRoot "/etc/httpd"
Listen 80
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin root@localhost
<Directory />
AllowOverride none
Require all denied
</Directory>
<Directory /var/www/tilecache>
AddHandler cgi-script .cgi
Options +ExecCGI
</Directory>
DocumentRoot "/var/www/html"
<Directory /var/www/tilecache-2.11>
AddHandler cgi-script .cgi
Options +ExecCGI
</Directory>
<Directory "/var/www">
AllowOverride None
# Allow open access:
Require all granted
</Directory>
# Further relax access to the default document root:
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<Files ".ht*">
Require all denied
</Files>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule mime_module>
TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
# For type maps (negotiated resources):
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
AddDefaultCharset UTF-8
<IfModule mime_magic_module>
MIMEMagicFile conf/magic
</IfModule>
EnableSendfile on
IncludeOptional conf.d/*.conf
the tilecache.cfg file is as follows
[cache]
type=Disk
base=/var/www/tilecache
[basic]
type=WMS
url=http://labs.metacarta.com/wms/vmap0
extension=png
[apdem]
type=WMS
url=https://test.com/mapserver/cgi-bin/mapserv?map=RMapFiles/apdem.map
extension=png
srs=EPSG:4326
layers=apdem
I have changed working directory in apache from html to cgi-bin the following error is appearing I extracted the tilecache code into cgi-bin and now the error was rectified with new error asAn error occurred:
File contains no section headers.
file: /var/www/cgi-bin/tilecache-2.11/tilecache.cfg, line: 1
'd# Configuration for MC TileCache\n'
File "/var/www/cgi-bin/tilecache-2.11/TileCache/Service.py", line 85, in _load
config.read(files)
File "/usr/lib64/python2.7/ConfigParser.py", line 305, in read
self._read(fp, filename)
File "/usr/lib64/python2.7/ConfigParser.py", line 512, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
svc = Service.load("C:\\TileCache\\tilecache.cfg")
but with your path