Setting Up A Reverse Proxy On Centos7

less than 1 minute read


Follow these steps to create a reverse proxy using Apache on Centos7.

To Resolve:

  1. Open a terminal and type: yum install httpd mod_ssl. This installs Apache and the mod_ssl packages.

  2. Now we configure our proxy settings:

    • Make sure that the file /etc/httpd/conf.d has the line includes /etc/httpd/conf.d/*.conf at the end.
    sudo vi /etc/httpd/conf.d/rproxy.conf
    # Paste in:
    ProxyRequests Off
    ProxyPass /test1 connectiontimeout=5 timeout=30
    ProxyPassReverse /test1
    ProxyPass /test2 connectiontimeout=5 timeout=30
    ProxyPassReverse /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
  3. 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


“Forward & Reverse Apache Proxy – CentOS 7”

Categories: ,