Secure Docker Deployment

Secure docker instance with basic Authentication

Nginx reverse proxy with Basic Authentication

secureITmania
2 min readJul 1, 2022

--

Introduction:

Recently, I faced a challenge to deploy a docker web application with basic authentication. Instead of modifying the docker web application, I deployed the docker instance behind the Nginx reverse proxy with Basic Auth. So I want to share the process and challenges I faced in order to deploy the docker web app.

Nginx-Docker Reverse Proxy illustration

Stage 1: Setup Nginx and Basic Authentication:

First, we have to install Nginx and set up a password for basic authentication.

sudo apt-get install nginx

setup basic authentication credentials usinghtpasswd.

sudo htpasswd -c /etc/nginx/.htpasswd <setup_username>
#Running this will prompt you a password, pick a password and store it in a safe place.

If you got an error while executing the above command like htpasswd command not found. Then try the below command to install htpasswd

sudo apt-get install apache2-utils

Stage 2: Configure Nginx:

--

--