How To Use Nginx As A Reverse Proxy With SSL (Tutorial)

nxinx-reverse-proxy-ssl
Nginx is a powerful tool. It allows you to serve multiple apps, websites, load-balance applications and much more. All that flexibility is powered by a relatively simple configuration system that uses nearly-human-readable configuration files.

Why use Nginx as a reverse proxy?

It may not be directly obvious why you might need a reverse proxy, but Nginx is a great option for serving your web apps-- take, for example, a NodeJS app. By default, it runs locally on a machine and listens on a custom-defined port. Usually, this is port 3000 by default and is accessed by typing something like http://YOUR-DOMAIN:3000 . But Nginx lets you serve your app that is running on a non-standard port without needing to attach the port number to the URL. It even lets you run different apps on each subdomain, or even in different sub-folders! Cool, right? This guide will demonstrate how to utilize Nginx to serve a web app, such as a NodeJS App, using SSL Encryption.

Prerequisites

This guide will assume a general understanding of using a Linux-based system via command line, and will further assume the following prerequisites:
  • Ubuntu 18.04
  • Non-Root User
  • App Running on Custom Port (this guide assumes port 3000)
  • DNS A Name Record for Domain Used
  • SSL Certificate For the Domain

Nginx Configuration

The default configuration for Nginx on Ubuntu 18.04, when installed using the Nginx-full package option, is to look for available sites at the following location: /etc/nginx/sites
Continue reading this article
by subscribing to our newsletter.
Subscribe now