Apache reverse proxy

March 11, 2019 2.2k views
Apache Debian

Hi Guys, could you please help me to solve my problem?

I’ve multiple webservers (for private use) behind the firewall and Apache reverse proxy (with VirtualHost) on my private network. Now I added a QNAP NAS with domaine name like nas.myqnapcloud.com with SSL installed on the NAS. I can connect to my NAS from internet when I by-pass the proxy but with proxy I don’t know the correct redirection rule to be added to the VirtualHost file in order to redirect the port 443 to my NAS

Anyone have a idea?
Thanks for your help
Raph.

1 Answer

Hey friend,

You can add reverse proxy rules to an SSL virtual host in the same way that you add it to a non-SSL virtual host. For your reference as well as that of anyone else reading, you can find instructions for creating a reverse proxy with Apache here:

https://www.digitalocean.com/community/tutorials/how-to-use-apache-as-a-reverse-proxy-with-mod_proxy-on-ubuntu-16-04

Additional references:
https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-16-04
https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-16-04

Jarland

by Brennen Bearnes
The Apache web server is the most popular way to serve web content on the internet. Apache has the ability to serve multiple domains from a single server by using a mechanism called "virtual hosts". If a virtual host is configured correctly for each domain, the web server can correctly route traffic to the appropriate files based on the domain name requested. In this guide, we'll demonstrate how to configure Apache virtual hosts on an Ubuntu 16.04 server.
  • Hi Jarland,
    Thanks for your reply. I try this following VirtualHost setting for port 80 (HTTP) and it’s working fine.

    <VirtualHost *:80>
            ServerName nas.myqnapcloud.com
            ProxyRequests Off
    
            ProxyPass / http://10.10.10.2:8080/
            ProxyPassReverse / http://10.10.10.2:8080/
    </VirtualHost>
    

    But when I try to redirect 443 port (HTTPS) it’s not working. What is the error in this following VirtualHost settings:

    <VirtualHost *:443>
            ServerName nas.myqnapcloud.com
            ProxyRequests Off
    
            ProxyPass / https://10.10.10.2/
            ProxyPassReverse / https://10.10.10.2/
    </VirtualHost>
    

    Thanks for your help.
    Raphy.

Have another answer? Share your knowledge.