Setting Up A Reverse Proxy On Centos7
Description:
Follow these steps to create a reverse proxy using Apache on Centos7.
To Resolve:
-
Open a terminal and type:
yum install httpd mod_ssl
. This installs Apache and the mod_ssl packages. -
Now we configure our proxy settings:
- Make sure that the file
/etc/httpd/conf.d
has the lineincludes /etc/httpd/conf.d/*.conf
at the end.
1 2 3 4 5 6 7 8 9 10
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
- Make sure that the file
-
Now we install the
mod_proxy_html
module so that it can rewrite html links:1 2 3 4 5 6 7
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
Comments