{"id":1671,"date":"2018-10-25T21:09:25","date_gmt":"2018-10-25T21:09:25","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=1671"},"modified":"2018-10-26T08:05:48","modified_gmt":"2018-10-26T08:05:48","slug":"mod_proxy-installation-and-configuration-on-apache","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/25\/mod_proxy-installation-and-configuration-on-apache\/","title":{"rendered":"mod_proxy Installation and Configuration on Apache"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/linuxadmin.io\/wp-content\/uploads\/2017\/05\/mod_proxy-4.png\" alt=\"mod_proxy installation on Apache\" width=\"528\" height=\"220\" \/><\/p>\n<h3>Introduction<\/h3>\n<p>mod_proxy is a proxy\/gateway for the Apache server. It allows you to direct Apache requests to other sites and\/or ports within the web server. It can also support load balancing algorithms as well. This guide assumes you already have Apache 2.2 installed from source to build the modules. To read more about it you can review the module documentation on <a href=\"https:\/\/httpd.apache.org\/docs\/2.2\/mod\/mod_proxy.html\">Apache\u2019s mod_proxy page<\/a><\/p>\n<h3>Install mod_proxy<\/h3>\n<p>Go to the source directory of the Apache installation<\/p>\n<p>cd \/usr\/src\/httpd-2.2.24<\/p>\n<p>Replace the path with where you downloaded the Apache installation.<\/p>\n<p>Reconfigure the existing apache configuring appending the mod_proxy lines<\/p>\n<p>.\/config-nice &#8211;enable-proxy=shared<\/p>\n<p>Rebuild Apache:<\/p>\n<p>make<\/p>\n<p>Install the new Apache<\/p>\n<p>make install<\/p>\n<p>Once you have done that you will want to edit the Apache Configuration to load the modules<\/p>\n<p>vim \/etc\/httpd\/conf\/httpd.conf<\/p>\n<p>Add the following modules and save the file<\/p>\n<p>LoadModule proxy_module lib\/apache\/mod_proxy.so<br \/>\nLoadModule proxy_http_module lib\/apache\/mod_proxy_http.so<br \/>\nLoadModule proxy_balancer_module lib\/apache\/mod_proxy_balancer.so<br \/>\nLoadModule proxy_connect_module lib\/apache\/mod_proxy_connect.so<br \/>\nLoadModule proxy_ftp_module lib\/apache\/mod_proxy_ftp.so<br \/>\nLoadModule proxy_scgi_module lib\/apache\/mod_proxy_scgi.so<br \/>\nLoadModule proxy_ajp_module lib\/apache\/mod_proxy_ajp.so<\/p>\n<p>Restart Apache to load them<\/p>\n<p>service httpd restart<\/p>\n<h3>Configure mod_proxy<\/h3>\n<p>Once mod_proxy is loaded you can now configure it to work on domains.<\/p>\n<h4>Reverse Proxy Configuration:<\/h4>\n<p>&lt;VirtualHost 192.168.1.10:80&gt;<br \/>\nServerName domain.com<br \/>\nProxyPreserveHost On<br \/>\nProxyPass \/ http:\/\/127.0.0.1:8080\/<br \/>\nProxyPassReverse \/ http:\/\/127.0.0.1:8080\/<br \/>\n&lt;\/VirtualHost&gt;<\/p>\n<p>This example will pass requests to the same server on port :8080. You could utilize this to pass requests do a different application, java, ruby, tomcat etc.<\/p>\n<h4>SSL Reverse Proxy Configuration:<\/h4>\n<p>&lt;VirtualHost 192.168.1.10:443&gt;<br \/>\nServerName domain.com<br \/>\nProxyPreserveHost On<br \/>\nProxyPass \/ http:\/\/127.0.0.1:8080\/<br \/>\nProxyPassReverse \/ http:\/\/127.0.0.1:8080\/<br \/>\nSSLCertificateFile \/path\/to\/certificate.crt<br \/>\nSSLCertificateKeyFile \/path\/to\/certificate.key<br \/>\nSSLCertificateChainFile \/path\/to\/chainfile.crt<br \/>\n&lt;\/VirtualHost&gt;<\/p>\n<p>This configuration is almost identical except you are setting the variables for SSL Configuration.<\/p>\n<h4>Load Balancing Proxy Configuration:<\/h4>\n<p>This allows you to utilize multiple back-end servers with a single Apache front-end load balancing the requests.<\/p>\n<p>&lt;Proxy balancer:\/\/cluster&gt;<br \/>\nBalancerMember http:\/\/192.168.1.10:8080\/<br \/>\nBalancerMember http:\/\/192.168.1.11:8080\/<br \/>\n&lt;\/Proxy&gt;<\/p>\n<p>&lt;VirtualHost 192.168.1.10:80&gt;<br \/>\nServerName domain.com<br \/>\nProxyPass \/ balancer:\/\/cluster<br \/>\n&lt;\/VirtualHost&gt;<\/p>\n<p>You would add in the IP addresses for each of the members to be load balanced as BalancerMember.<\/p>\n<p>Once you have added the new configurations, you go ahead and restart apache again to load in the new mod_proxy settings<\/p>\n<p>service httpd restart<\/p>\n<p>May 22, 2017LinuxAdmin.io<\/p>\n<p><a href=\"https:\/\/linuxadmin.io\/mod_proxy-installation-apache\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction mod_proxy is a proxy\/gateway for the Apache server. It allows you to direct Apache requests to other sites and\/or ports within the web server. It can also support load balancing algorithms as well. This guide assumes you already have Apache 2.2 installed from source to build the modules. To read more about it you &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/25\/mod_proxy-installation-and-configuration-on-apache\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;mod_proxy Installation and Configuration on Apache&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1671","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1671","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=1671"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1671\/revisions"}],"predecessor-version":[{"id":1715,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1671\/revisions\/1715"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=1671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=1671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=1671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}