1 / 26

The Power of mod_proxy

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?

india
Download Presentation

The Power of mod_proxy

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Power of mod_proxy • Proxy servers, load balancers and how to implement with Apache HTTP Server.

  2. Hello World • Paul Weinstein • Web Programmer/Analyst at Orbit Media Studios, Inc.

  3. Proxy Servers

  4. Proxy Servers • What is a Proxy Server? • When Might a Proxy Server Be Useful? • How to Implement a Proxy Server with Apache HTTP Server?

  5. 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

  6. 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

  7. When Might a Proxy Server Be Useful?

  8. 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

  9. When Might a Proxy Server Be Useful?

  10. Implementing a Proxy Server with HTTP Server • Standard Apache Distribution: • mod_proxy • mod_proxy_http • mod_proxy_ftp • mod_proxy_ajp • mod_proxy_connect • Third Party: • mod_proxy_html* • In Association with: • mod_cache • mod_ssl * Move to standard distribution as part of v2.4.0, http://bahumbug.wordpress.com/2011/10/28/modules-move-home/

  11. Implementing a Forward Proxy Server with HTTP Server • ProxyRequests OnProxyVia On

  12. Implementing a Proxy Server with HTTP Server • <Proxy *> • Order Deny,Allow • Deny from all • Allow from 192.168.0 • </Proxy>

  13. 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

  14. Load Balancers

  15. Load Balancers • What is a Load Balancer? • When Might a Load Balancing be Useful? • How to Implement a Load Balancer with Apache HTTP Server

  16. 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)

  17. When Might Load Balancing be Useful?

  18. Implementing a Proxy Server with HTTP Server • 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* • In Association with: • mod_cache • mod_ssl * Move to standard distribution as part of v2.4.0, http://bahumbug.wordpress.com/2011/10/28/modules-move-home/

  19. Implementing a Failover Load Balancer with HTTP Server • ProxyRequests 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>

  20. 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)

  21. When Might Load Balancing be Useful?

  22. Implementing a Load Balancer with HTTP Server • ProxyRequests Off • ProxyPass /webapp balancer://cluster \ • stickysession=SESSIONID nofailover=On

  23. 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>

  24. 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>

  25. 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>

  26. 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

More Related