Apache 2 mod_proxy

mod_proxy related modules

* mod_proxy: The core module deals with proxy infrastructure and configuration and managing a proxy request.
* mod_proxy_http: This handles fetching documents with HTTP and HTTPS.
* mod_proxy_ftp: This handles fetching documents with FTP.
* mod_proxy_connect: This handles the CONNECT method for secure (SSL) tunneling.
* mod_proxy_ajp: This handles the AJP protocol for Tomcat and similar backend servers.
* mod_proxy_balancer implements clustering and load-balancing over multiple backends.
* mod_cache, mod_disk_cache, mod_mem_cache: These deal with managing a document cache. To enable caching requires mod_cache and one or both of disk_cache and mem_cache.
* mod_proxy_html: This rewrites HTML links into a proxy’s address space.
* mod_headers: This modifies HTTP request and response headers.
* mod_deflate: Negotiates compression with clients and backends.

Install mod_proxy_html

mod_proxy_html is not included with Apache core so needs to be installed separately.
* Download mod_proxy_html-3.0.1-w32.zip from apachelounge.com.
* Extract mod_proxy_html folder onto Apache modules directory.
* Download and install Visual C++ 2008 Redistributable Package vcredist_x86.exe
* Edit modules/mod_proxy_html/proxy_html.conf file to include:

# May also need zlib.dll and iconv.dll
LoadFile modules/mod_proxy_html/libxml2.dll
LoadModule  proxy_html_module modules/mod_proxy_html/mod_proxy_html.so

* Add to httpd.conf

Include modules/mod_proxy_html/proxy_html.conf

Setup Reverse Proxy

LoadModule proxy_module      modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule headers_module    modules/mod_headers.so
 
# If using mod_proxy_html
#Include modules/mod_proxy_html/proxy_html.conf
 
<IfModule proxy_module>
  ProxyRequests Off
 
  <Proxy *>
  Order deny,allow
  Allow from all
  </Proxy>
 
  # http://www.my.com/app1/ will be served from http://internal.my.com:8080/
  ProxyPass /app1/ http://internal.my.com:8080/
 
  # http://internal.my.com:8080/ urls will be converted to http://www.my.com/app1/
  # so users don't know the content is served from http://internal.my.com:8080/
  ProxyPassReverse /app1/ http://internal.my.com:8080/ 
 
  # If using mod_proxy_html
  #ProxyHTMLURLMap http://internal.my.com:8080 /app1 # No tailing slash
  #<Location /app1/>
  #  ProxyPassReverse /
  #  SetOutputFilter  proxy-html
  #  ProxyHTMLURLMap  /      /app1/
  #  ProxyHTMLURLMap  /app1  /app1
  #  RequestHeader    unset  Accept-Encoding
  #</Location>
 
</IfModule>

References

http://www.apachetutor.org/admin/reverseproxies

This entry was posted in apache. Bookmark the permalink.