| 1 | == Serving Mapguide Tiles directly via Apache == |
| 2 | |
| 3 | For scalability, it can be useful to get apache to serve your map tiles directly. |
| 4 | |
| 5 | This allows the map tiles to be cached and it frees up the mapguide server process, which during high load |
| 6 | may have a request queue. |
| 7 | |
| 8 | The implementation involves exposing a single map's tile cache directory via apache httpd.conf |
| 9 | |
| 10 | {{{ |
| 11 | <Directory "C:/Program Files/MapGuideOpenSource2.0/Server/Repositories/TileCache/Samples_Sheboygan_MapsTiled_Sheboygan/"> |
| 12 | Options Indexes |
| 13 | ErrorDocument 404 /mapguide/seedSheboyganTile.php |
| 14 | Header set Cache-Control "max-age=86400, public" |
| 15 | AllowOverride None |
| 16 | Order allow,deny |
| 17 | Allow from all |
| 18 | </Directory> |
| 19 | Alias /sheboyganTiles/ "C:/Program Files/MapGuideOpenSource2.0/Server/Repositories/TileCache/Samples_Sheboygan_MapsTiled_Sheboygan/" |
| 20 | }}} |
| 21 | |
| 22 | Restart Apache |
| 23 | |
| 24 | The attached file contains seedSheboyganTile.php which is used to generate tiles which haven't been seeded yet, [[BR]] |
| 25 | save it in "C:\Program Files\MapGuideOpenSource2.0\WebServerExtensions\www" |
| 26 | |
| 27 | There is also a modified version of openlayers Mapguide.js which has a new option called "useHttpTile" which [[BR]] |
| 28 | when set to true will generate requests for the tiles as they are stored internally by the TileService, [[BR]] |
| 29 | the layer url then becomes http://localhost:8008/sheboyganTiles/ |
| 30 | |
| 31 | The httpCacheDemo.html file assumes you have openlayers installed under "C:\Program Files\MapGuideOpenSource2.0\WebServerExtensions\www\openlayers" [[BR]] |
| 32 | |
| 33 | Simply add the updated Mapguide.js to the openlayers\lib\OpenLayers\Layer directory and then open the httpCacheDemo.html file to try it out. |
| 34 | |
| 35 | |