Reverse Proxy with Multiple Backend Web Servers
2011-11-12 00:27
363 查看
转自:http://wiki.squid-cache.org/ConfigExamples/Reverse/MultipleWebservers
Warning: Any example presented here is provided "as-is" with no support or guarantee of suitability. If you have any further questions about these examples please email the squid-users mailing list.
Contents
Reverse
Proxy with Multiple Backend Web Servers
Sending
different requests to different backend web servers
Squid
Configuration
Switching
on Domains
Other
Criteria than Domain
To control which web servers (cache_peer) gets which requests the cache_peer_access or cache_peer_domain directives is used. These directives limit which requests may be sent to a given peer.
For example the websites are hosted like this on two servers:
www.example.com hosted on server1
example.com hosted on server1
download.example.com hosted on server2
*.example.net hosted on server2
example.net hosted on server2
Simple config using cache_peer_domain
Or the same using cache_peer_access:
It's also possible to route requests based on other criteria than the host name by using other acl types, such as urlpath_regex.
For our example here the websites /foo directory alone is hosted on a second server:
example.com is hosted on server1
example.com/foo is hosted on server2
CategoryConfigExample
Warning: Any example presented here is provided "as-is" with no support or guarantee of suitability. If you have any further questions about these examples please email the squid-users mailing list.
Contents
Reverse
Proxy with Multiple Backend Web Servers
Sending
different requests to different backend web servers
Squid
Configuration
Switching
on Domains
Other
Criteria than Domain
Sending different requests to different backend web servers
To control which web servers (cache_peer) gets which requests the cache_peer_access or cache_peer_domain directives is used. These directives limit which requests may be sent to a given peer.For example the websites are hosted like this on two servers:
www.example.com hosted on server1
example.com hosted on server1
download.example.com hosted on server2
*.example.net hosted on server2
example.net hosted on server2
Squid Configuration
Switching on Domains
Simple config using cache_peer_domaincache_peer ip.of.server1 parent 80 0 no-query originserver name=server_1 cache_peer_domain server_1 www.example.com example.com cache_peer ip.of.server2 parent 80 0 no-query originserver name=server_2 cache_peer_domain server_2 download.example.com .example.net
Or the same using cache_peer_access:
cache_peer ip.of.server1 parent 80 0 no-query originserver name=server_1 acl sites_server_1 dstdomain www.example.com example.com cache_peer_access server_1 allow sites_server_1 cache_peer ip.of.server2 parent 80 0 no-query originserver name=server_2 acl sites_server_2 dstdomain www.example.net download.example.com .example.net cache_peer_access server_2 allow sites_server_2
Other Criteria than Domain
It's also possible to route requests based on other criteria than the host name by using other acl types, such as urlpath_regex.For our example here the websites /foo directory alone is hosted on a second server:
example.com is hosted on server1
example.com/foo is hosted on server2
acl foo urlpath_regex ^/foo cache_peer ip.of.server1 parent 80 0 no-query originserver name=server1 cache_peer_access server1 deny foo cache_peer ip.of.server2 parent 80 0 no-query originserver name=server2 cache_peer_access server2 allow foo cache_peer_access server2 deny all
Remember that the cache is on the requested URL and not which peer the request is forwarded to so don't use user dependent acls if the content is cached. |
相关文章推荐
- Multiple Vulnerabilities with 8.3 Filename Pseudonyms in Web Servers
- Multiple Vulnerabilities with 8.3 Filename Pseudonyms in Web Servers
- Websocket 与代理服务器如何交互? How HTML5 Web Sockets Interact With Proxy Servers
- Reverse Proxy Web Sockets with Nginx and Socket.IO
- [Webpack 2] Chunking common modules from multiple apps with the Webpack CommonsChunkPlugin
- web_reverse_proxy --> haproxy
- Perlbal is our Perl-based reverse proxy load balancer and web server
- Multiple Web Servers
- HAR with Python WebDriver and BrowserMob Proxy
- Differences Between 3 Types Of Proxy Servers: Normal, Transparent And Reverse Proxy
- Tunneling TCP based protocols through Web proxy servers
- Proxy for multiple cloud instances with multiple portals
- How to bind a GridView to a list of multiple types? NHibernate proxy causing problems with databinding [From stack overflow]
- pacparser - A library to make your web software pac (proxy auto-config) files intelligent. Comes with much useful pactester tool now. - Google Project Hosting
- Configure Excel Services with multiple servers in SharePoint Server 2013
- Passing Multiple Parameters to ASP.NET Web API With jQuery
- Share Precompiled Header with multiple projects
- Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple
- JavaScript: Create Advanced Web Applications With Object-Oriented Techniques
- Web Component Development with Servlets & JSPs, Java EE 6