Upload
india
View
60
Download
1
Embed Size (px)
DESCRIPTION
The Power of mod_proxy. Proxy servers, load balancers and how to implement with Apache HTTP Server. Hello World. Paul Weinstein Web Programmer/Analyst at Orbit Media Studios, Inc. Proxy Servers. Proxy Servers. What is a Proxy Server? When Might a Proxy Server Be Useful? - PowerPoint PPT Presentation
Citation preview
The Power of mod_proxy
Proxy servers, load balancers and how to implement with Apache HTTP Server.
Hello World
• Paul Weinstein
• Web Programmer/Analyst at Orbit Media Studios, Inc.
Proxy Servers
Proxy Servers
What is a Proxy Server?
When Might a Proxy Server Be Useful?
How to Implement a Proxy Server with Apache HTTP Server?
What is a Proxy Server?
“A server that acts as an intermediary for requests from clients seeking resources from other servers.”1
1 From Wikipedia, http://en.wikipedia.org/wiki/Proxy_server
When Might a Proxy Server Be Useful?
“To provide Internet access to internal clients that are otherwise restricted by a firewall.”
“The proxy can also use caching to reduce network usage.”2
2 Apache Module mod_proxy Documentation, http://httpd.apache.org/docs/2.1/mod/mod_proxy.html
When Might a Proxy Server Be Useful?
When Might a Proxy Server Be Useful?
“To provide Internet users access to a server that is behind a firewall.”
“Provide caching for a slower back-end server.”
“Be used simply to bring several servers into the same URL space”
“Be used to balance load among several back-end servers.” 2
2, Apache Module mod_proxy Documentation, http://httpd.apache.org/docs/2.1/mod/mod_proxy.html
When Might a Proxy Server Be Useful?
Implementing a Proxy Server with HTTP ServerIn Association
with:
•mod_cache
•mod_ssl
Standard Apache Distribution:
•mod_proxy
•mod_proxy_http
•mod_proxy_ftp
•mod_proxy_ajp
•mod_proxy_connect
Third Party:
•mod_proxy_html*
* Move to standard distribution as part of v2.4.0, http://bahumbug.wordpress.com/2011/10/28/modules-move-home/
Implementing a Forward Proxy Server with HTTP
Server
ProxyRequests OnProxyVia On
Implementing a Proxy Server with HTTP Server
<Proxy *>
Order Deny,Allow
Deny from all
Allow from 192.168.0
</Proxy>
Implementing a Reverse Proxy Server with HTTP
Server
ProxyRequests Off
ProxyPass /back http://backend.example.com
ProxyPassReverse /back http://backend.example.com
ProxyHTMLURLMap http://backend.example.com /back
Load Balancers
Load Balancers
What is a Load Balancer?
When Might a Load Balancing be Useful?
How to Implement a Load Balancer with Apache HTTP Server
What is a Load Balancer?
“A networking methodology to distribute workload across multiple resources.”3
3 From Wikipedia, http://en.wikipedia.org/wiki/Load_balancing_(computing)
When Might Load Balancing be Useful?
Implementing a Proxy Server with HTTP ServerIn Association
with:
•mod_cache
•mod_ssl
Standard Apache Distribution:
•mod_proxy
•mod_proxy_http
•mod_proxy_ftp
•mod_proxy_ajp
•mod_proxy_connect
•mod_proxy_balancer
Third Party:
•mod_proxy_html*
* Move to standard distribution as part of v2.4.0, http://bahumbug.wordpress.com/2011/10/28/modules-move-home/
Implementing a Failover Load Balancer with HTTP
ServerProxyRequests Off
ProxyPass /webapp balancer://cluster
ProxyPassReverse /webapp http://prime.example.com:80
ProxyPassReverse /webapp http://fail.example.com:80
ProxyHTMLURLMap http://prime.example.com:80 /webapp
ProxyHTMLURLMap http://fail.example.com:80 /webapp
<Proxy balancer://cluster>
BalancerMember http://prime.example.com:80
BalancerMember http://fail.example.com:80 status=+H
</Proxy>
When Might Load Balancing be Useful?
“Distribute workload across multiple computers or a computer cluster ... to achieve optimal resource utilization, maximize throughput, minimize response time, and avoid overload.”3
3 From Wikipedia, http://en.wikipedia.org/wiki/Load_balancing_(computing)
When Might Load Balancing be Useful?
Implementing a Load Balancer with HTTP Server
ProxyRequests Off
ProxyPass /webapp balancer://cluster \
stickysession=SESSIONID nofailover=On
Implementing a Load Balancer with HTTP Server<Location /webapp>
ProxyPassReverse /webapp http://app1.example.com:80
ProxyPassReverse /webapp http://app2.example.com:80
ProxyPassReverse /webapp http://app3.example.com:80
ProxyHTMLURLMap http://app1.example.com:80 /webapp
ProxyHTMLURLMap http://app2.example.com:80 /webapp
ProxyHTMLURLMap http://app3.example.com:80 /webapp
ProxyPassReverseCookiePath /webapp/ /webapp
RequestHeader unset Accept-Encoding
</Location>
Implementing a Load Balancer with HTTP Server
<Proxy balancer://cluster>
BalancerMember http://app1.example.com:80 loadfactor=50 route=app1
BalancerMember http://app2.example.com:80 loadfactor=25 route=app2
BalancerMember http://app3.example.com:80 loadfactor=25 route=app3
</Proxy>
Implementing a Load Balancer with HTTP Server
ProxyRequests Off
ProxyPass /webapp balancer://cluster stickysession=JSESSIONID nofailover=On
<Location /webapp>
ProxyPassReverse /webapp http://app1.example.com:80
ProxyPassReverse /webapp http://app2.example.com:80
ProxyPassReverse /webapp http://app3.example.com:80
ProxyHTMLURLMap http://app1.example.com:80 /webapp
ProxyHTMLURLMap http://app2.example.com:80 /webapp
ProxyHTMLURLMap http://app3.example.com:80 /webapp
ProxyPassReverseCookiePath /webapp/ /webapp
RequestHeader unset Accept-Encoding
</Location>
<Proxy balancer://cluster>
BalancerMember http://app1.example.com:80 loadfactor=50 route=app1
BalancerMember http://app2.example.com:80 loadfactor=25 route=app2
BalancerMember http://app3.example.com:80 loadfactor=25 route=app3
</Proxy>
Resources/Questions
• http://httpd.apache.org/docs/2.2/mod/mod_proxy.html
• http://www.apachetutor.org/admin/reverseproxies
• http://apache.webthing.com/mod_proxy_html/
• http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html
• http://pdw.weinstein.org
• @pdweinstein