User:Kannix/tilestache

From OpenStreetMap Wiki
Jump to: navigation, search

tilestache mod_python on parallels PLESK

Had a hard time getting tilestache running under mod_python on my plesk machine: 404 Not Found error :-(
(tested on plesk 11 / plesk 12)

This should work:

  • make sure, mod_python is installed:
    • server settings > tools & settings > plesk > updates and upgrades > Add/Remove Components > Web hosting features > Apache mod_python module
  • check domain settings:
    • Hosting Services > Domains > [yourdomain.tld] > Manage Hosting > Websites & Domains > show more > hosting settings > UNCHECK Python support
    • checking 'python support' leads plesk to add this to /var/www/vhosts/system/[yourdomain.tld]/conf/httpd.conf (httpd.conf is autogenerated by plesk and not editable by user!)
           <IfModule mod_python.c>
               <Files ~ (\.py$)>
                   SetHandler python-program
                   PythonHandler mod_python.cgihandler
               </Files>
           </IfModule>
  • add custom httpd directives:
    • Hosting Services > Domains > [yourdomain.tld] > Manage Hosting > Websites & Domains > show more > Web Server Settings > Additional directives for HTTP
<Directory /var/www/vhosts/[yourdomain.tld]/httpdocs>
   AddHandler mod_python .py
   PythonHandler TileStache::modpythonHandler
   PythonOption config /etc/tilestache.cfg
</Directory>

tilestache and nginx on parallels PLESK

serving-your-map-tiles-30-times-faster

  • make sure, nginx is installed:
    • server settings > tools & settings > plesk > updates and upgrades > Add/Remove Components > Web hosting features > Nginx web server and reverse proxy support
  • add custom httpd directives:
    • Hosting Services > Domains > [yourdomain.tld] > Manage Hosting > Websites & Domains > show more > Web Server Settings > nginx settings
      • check 'Smart static files processing'
      • check 'Serve static files directly by nginx' and remove png from list
      • Additional nginx directives:
location  ~ ^\/tiles.py\/(?<tile_path>.*)$ {
   alias /tmp/stache/;
   log_not_found off;
   expires 30d;
   add_header Pragma public;
   add_header Cache-Control "public";
   add_header X-Static super;
   try_files $tile_path @tilestache;
}
location @tilestache {
   log_not_found off;
   proxy_pass http://[your-server-IP]:7080;
   proxy_set_header Host $host;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   expires 30d;
   etag on;
   add_header X-Static miss;
}