Centos – Reverse proxy (CentOS apache server) not working after adding SSL

apache-2.4centosreverse-proxyssl

I'm trying to create a reverse proxy using apache server that I installed into CentOS.

I followed this tutorial: https://www.digitalocean.com/community/tutorials/how-to-use-apache-as-a-reverse-proxy-with-mod_proxy-on-centos-7, and used the mod_proxy extension to create the reverse proxy. I created a file "default-site.conf" under "/etc/httpd/conf.d/default-site.conf" and the contents inside are:

<VirtualHost *:80>
    ProxyPreserveHost On

    ProxyPass / http://(ip address of website hidden by reverse proxy)/
    ProxyPassReverse / http://(ip address of website hidden by reverse proxy)/
</VirtualHost>

The reverse proxy worked. When I typed the reverse proxy server's ip address, it redirected me to the (ip address of website hidden by reverse proxy). But it stopped working after I followed this tutorial to add SSL: https://devops.profitbricks.com/tutorials/how-to-set-up-apache-web-server-on-centos-7/.

I started from the section "Set up a secure Apache HTTPS server with SSL". In the ssl.conf file under "/etc/httpd/conf.d/ssl.conf", I uncommented and changed these 2 lines:

DocumentRoot "/var/www/html"
ServerName (server name):443

After that, when I typed the reverse proxy server's ip address, the only page I see is this:
enter image description here

How do I make my reverse proxy work again, and redirect to the "hidden website" with SSL?

Best Answer

You need write your configuration VirtualHost 80 in VirtualHost 443. https - may be, need try.

<VirtualHost *:443>
    ProxyPreserveHost On

    ProxyPass / httpS://(ip address of website hidden by reverse proxy)/
    ProxyPassReverse / httpS://(ip address of website hidden by reverse proxy)/
</VirtualHost>
Related Topic