Via Cà Matta 2 - Peschiera Borromeo (MI)
+39 02 00704272
info@synaptica.info

How To Use Apache as a Reverse Proxy on Ubuntu 20.04

Digital solution partner

How To Use Apache as a Reverse Proxy on Ubuntu 20.04

A reverse proxy is a type of proxy server that accepts HTTP (S) requests and transparently distributes them to one or more backend servers.

You can use a reverse proxy to prevent direct access to these underlying application servers. They can also be used to distribute the load of incoming requests to different application servers.

In this tutorial, you will configure Apache as a basic reverse proxy using the mod_proxy extension to redirect incoming connections to one or more backend servers running on the same network.

Install the Apache Web Server.

Enabling Necessary Apache Modules.

If you need to enable the SSL module in Apache.

You can also enable Apache Mod_Rewrite that provides URL manipulation capability.

To put these changes into effect, restart Apache.

Now you will need to disable the default configuration to avoid that your reverse proxy works as a web server

 

Example of a load balancer configuration:

 

Create a configuration to serve two or more backend services with this prerequirement:

  1. redirect http request  to https
  2. serve https when your be services are clear text (http)
  3. balacing with two services

suppose to configure a domain name “mydomain.com” and the be services responds on 10.10.01.20:18000 and 10.10.01.20:22000

now you need to edit the conf file at /etc/apache2/site-available/ : 

 

 

insert this code and replace with your custom settings:

enable the configuration:

thats it