Follow these steps to create a reverse proxy using Apache on Centos7.
Open a terminal and type: yum install httpd mod_ssl # this installs Apache and the mod_ssl packages.
Now we configure our proxy settings:
NOTE: Make sure that the file “/etc/httpd/conf.d” has the “includes /etc/httpd/conf.d/*.conf” at the end.
sudo vi /etc/httpd/conf.d/rproxy.conf # Paste in: ProxyRequests Off ProxyPass /test1 http://192.168.10.59:8080/test1 connectiontimeout=5 timeout=30 ProxyPassReverse /test1 http://192.168.10.59:8080/test1 ProxyPass /test2 http://192.168.10.59:8080/test2 connectiontimeout=5 timeout=30 ProxyPassReverse /test2 http://192.168.10.59:8080/test2 #Note that proxy pass can point to a different server, different host name or IP address. The “connectiontimeout” is the time it takes to create the connection to the backend and “timeout” is the time proxy waits for response from backend. #Save and exit
- Now we install the mod_proxy_html module so that it can rewrite html links:
sudo yum install mod_proxy_html # Copy its config file to your httpd directory without changing any values cp /usr/share/doc/httpd-2.4.6/proxy-html.conf /etc/httpd/conf.d/ # Now just restart Apache and test! sudo systemctl restart httpd