How to configure Apache as a reverse proxy server in Centos

Step1: Check the required Apache modules enabled or not. If its already enabled, can jump to step 5.


Step2: Enable the moduled if not installed. Open the file /etc/httpd/conf.modules.d/00-proxy.conf.

#vi /etc/httpd/conf.modules.d/00-proxy.conf

Step3: Uncomment the following lines and save.

LoadModule proxy_module modules/
LoadModule lbmethod_byrequests_module modules/
LoadModule proxy_balancer_module modules/
LoadModule proxy_http_module modules/

Step4: Restart Apache.

#systemctl restart httpd

Step5: Open virtualhost file and update the reverse proxy configuration.

<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyPass / http://backendip:port/
    ProxyPassReverse / http://backendip:port/

Here we need to replace backendip and port with the corresponding values.

Step6: Restart Apache

#systemctl restart httpd

That's all…

Leave a Reply