|05-05-2009, 02:22 AM||#1|
Join Date: May 2006
SQUID configuration to cache WMS server responses
Attached is a sample squid.conf file.
All changes in this file are marked with "##WorldWindWms" tag, so it will be easier to find changes.
These instructions are for windows deployment, unix version is not too different.
1. download squid from here http://squid.acmeconsulting.it/downl...TABLE6-bin.zip
2. unzip and move the “squid” folder to the “C:\” , so all squid files will be under the C:\squid folder
3. go to the “C:\squid\etc” and make a backup copy of all configuration files, let’s say create a sub-folder “backup” and copy all *.default files to the c:\squid\etc\backup
4. rename all configuration files in the c:\squid\etc by removing extension “.default”, so you should have only four *.conf files or download the attached squid.config.txt and rename to the squid.config
5. open the squid.conf for editing
6. in the “C:\squid\etc\squid.conf" file, go to the near line 624 and type next two lines (copy and past)
OR search for "acl CONNECT method CONNECT" and add next lines (modify yourMachineName)
##WorldWindWms: open access to the WMS running locally....
acl nasa dstdomain YourMachineNameHere
acl wms urlpath_regex ^/wms
acl elev urlpath_regex ^/elev
7. go to near line 668
OR search for "# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS"
##WorldWindWms: rule for the WMS...
http_access allow wms
http_access allow nasa
http_access allow elev
8. go to the line 1954 or search "##WorldWindWms: make disk cache 10GB"
and change a cache size to 10GB (make sure you use forward slashes even for Windows)
##WorldWindWms: make disk cache 10GB
cache_dir ufs c:/squid/var/cache 10000 16 256
9. go to the line 1706 or search for "# TAG: hierarchy_stoplist"
and remove a question sign, it should look like this
##WorldWindWms: don't exclude dynamic queries to WMS
hierarchy_stoplist cgi-bins ?
10. go to the line 2620 (in near OPTIONS FOR TUNING THE CACHE) and add next three lines
##WorldWindWms: We don't want to exclude dynamic queries to our WMS!
acl QUERY urlpath_regex cgi-bin
cache deny QUERY
11. go to the line 2775 or search for "##WorldWindWms: define a refresh patters"
and make sure it looks like this
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
##WorldWindWms: define a refresh patters
refresh_pattern . 1440 20% 4320
12. Go to the line 1106 and modify the port Squid will be using – most likely it will be port 80 if you want to cache all your web traffic
##WorldWindWms: Modify the http_port directive:
http_port 80 accel defaultsite= YourMachineNameHere
13. Go to line 1613 or search for "##WorldWindWms: cache WMS servers"
and define which servers(services) squid going to cache
##WorldWindWms: cache WMS servers running locally on port 8084
# AND with url path /wms and /elev
cache_peer 127.0.0.1 parent 8085 0 name=wmsserver no-query originserver
cache_peer 127.0.0.1 parent 8085 0 name=elevserver no-query originserver
cache_peer_access wmsserver allow wms
cache_peer_access elevserver allow elev
And if you want to cache another server, let’s say ESRI, you will need to know what port it is running and what url it is used
This is only an example – not tested, so do not use it!!
##WorldWindWms: cache ESRI server running locally on port 8080 AND with url path /eWMS
cache_peer 127.0.0.1 parent 8080 0 no-query originserver name=esriserver
acl esrirequest urlpath_regex ^/eWMS
cache_peer_access esriserver allow esrirequest
14. go to the line 3351 and set a visible name
NOTE! Whatever machine name you set here (and squid port), you should change wms_8085\WEB-INF\config.xml in the <online-resource> parameter and restart WMS server
If you do not change the <online-resource> parameter,
WW client will be trying to access WMS server (port 8085) because Capabilities document will not point to SQUID.
15. save the squid.conf file
16. go to the command line (Start->Run->cmd.exe) and change directory to c:\squid\sbin
17. create a cache folder by executing a command
squid –D –z
This should create a C:\squid\var\cache folder and initialize swap files
18. Install the squid service by executing command
19. Start the squid service by executing
net start squid
20. Reminder from Step 14
Make sure you have a correct hostname (or ip) in the
wms_8085\WEB-INF\config.xml file and restart WMS server \wms_8084\runWMS.bat
21. let’s test the squid (assuming SQUID is listenning on port 80, and your WMS server is on port 8085)
In the browser type http://localhost/wms?service=wms&req...etCapabilities and http://localhost/elev?service=wms&re...etCapabilities
You should get the GetCapabilities document served by squid, because squid is listening on port 80 and forwards the request to WMS on 8085, and caches the response.
Make sure inthe Capabilities document <OnlineResource> points to SQUID, not to WMS on port 8085.
If you get error, make sure squid and wmsd are running and listening on port 80 (squid) and 8085 (WMS).
Try to get the GetCapabilities from WMS directly: http://localhost:8085/wms?service=wm...etCapabilities
If you do not get the GetCapabilities from WMS, the problem is in the WMS service.
If you do get it from WMS, but do not get from Squid – the problem is in squid configuration.
If all works, try to stop the WMS server and try to get GetCapabilities from Squid while WMS service is down.
If everything is working right you should get a cached response.
Please remember that squid must at least once get the response from WMS before you stop the WMS service.
Last edited by garakl; 11-29-2009 at 06:40 AM.
|Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Some questions about the new wms server||vash||Development Help||12||10-28-2011 10:31 PM|
|LandSat I3 WMS cache packs?||martin_ulmschneider||Development Help||1||03-03-2010 01:21 AM|
|How to serve images via simple http without using WMS server?||shaheryar||Image Serving & GIS||2||01-28-2009 05:47 AM|
|Web Map Server (WMS) performance||web.rian||Development Help||2||09-13-2007 02:25 PM|