How to Configure a Nginx HTTPs Reverse Proxy on Ubuntu Server 20.04

We will use Nginx as a reverse proxy, which will serve all static content and pass the requests for dynamic content to Apache.

Follow these steps to set Nginx as a reverse proxy:

Step 1 : Install Nginx with the following command

Step 2 : Create a new site configuration under /etc/nginx/sites-available and add the following content to it:

Step 3 : Enable this new configuration by creating a symbolic link under sites-enabled

Step 4 : Install Apache

Step 5 : We need to change the Apache settings to listen on port 8080. This will leave port 80 to be used by Nginx

Step 6 : Also change NameVirtualHost, if you are using it

Step 7 : Create the virtual hosts settings to listen on port 8080

Step 8 : Enable our new VirtualHost with a2ensite and reload Apache:

Step 9 : Create a index.php

Step 10 : Save the changes and restart Apache, Nginx for the changes to take effect:

Step 11 : Check for open ports with the following command

Step 12 : Open your browser and point it to the IP address of your server.