Enable mod_proxy in apache

Apache with mod_proxy can be configured to forward client request to other servers. Here is how to enable mod_proxy with ProxyPass and ProxyPassReverse directives. It is recommended to create a configuration file test.conf at /httpd/conf.d/ instead of editing the /httpd/conf/httpd.conf

The difference between http and https configuration is only the port and proxy url.

For http => The port will be 80 and the URL is http://test.company.com
For https => The port will be 443 and the URL is https://test.company.com


</VirtualHost 10.20.10.111:80>

# Proxy Server directives. Uncomment the following lines to
# enable the proxy server:

ProxyRequests On

Order allow,deny
Allow from all

# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
ProxyVia On

# To enable a cache of proxied content, uncomment the following lines.
# See http://httpd.apache.org/docs/2.2/mod/mod_cache.html for more details.
# CacheEnable disk /
# CacheRoot "/var/cache/mod_proxy"
# End of proxy directives.

# Allows the proxying of a SSL connection
##SSLProxyEngine On

ProxyPreserveHost On

ServerName test.company.com
ErrorLog logs/test_http_error_log
CustomLog logs/test_http_access_log combined
ProxyPass / http://test.company.com/
ProxyPassReverse / http://test.company.com/

</VirtualHost>

0 comments: