Apache and Nginx are free, open-source and the most widely used web servers in the world. Apache is the number one server, while Nginx comes in the second place. Apache is known for its power and the backend compatibility while Nginx is known for its speed. Nginx provides a rich set of features including load balancing, security, and acceleration. Using Nginx as a reverse proxy allows you to use these features for any web application.
Configuring a reverse proxy helps you to hide the identity of your backend servers and protect your servers from attacks. A reverse proxy also performs load balancing and distributes client request across backend servers. This can very helpful when some servers become overloaded due to a sudden spike in client requests.
Using Nginx as a reverse proxy for Apache will allow both servers to work together and allow you to take advantage of the benefits of both servers. You can easily monitor what traffic goes in and out through the reverse proxy.
In this tutorial, we will learn how to install and configure Nginx as a reverse proxy for Apache on Ubuntu 18.04 VPS. We will configure Apache to run on port 8080, configure Nginx to run on port 80, and forward client requests coming on port 80 to the Apache webserver.