NginX as a reverse proxy with Nginx Proxy Manager

Lately I have started playing with Kubernetes and wanted to expose some of the locally hosted services on internet. The situation is that I want to expose multiple clusters running on separate machines through the same IP address and port. Checking around it seems nginx is the the best option. Keep in mind that even you want to expose just one service it is still good idea to do it through nginx.

I have installed Ubuntu 20.04.3 on Raspberry Pi 3B which will be used as reverse proxy.

Initially I installed the nginx directly on the Ubuntu machine and started playing with the configuration. It was not the best experience, so decided to look for a management GUI for nginx. This is how I found Nginx Proxy Manager (NPM).

It is installed in docker container together with the nginx itself. NPM provides nice Web GUI to configure the redirects you need.

First you need to install docker on your Ubuntu machine. Check the instructions here.

Once you have the docker and docker-compose installed follow the NPM installation instructions from here. I did the full setup. Note that if you are running on Raspberry Pi like me need to change the database image to ‘yobasystems/alpine-mariadb:latest’, as described in the instructions.

Note: For the deployment to be successful and for normal operation of the nginx you need to have ports 80, 81 and 443 available on the machine for docker. You should not run any other services on them.

Port 80 and 443 are for nginx and port 81 is for the Nginx Proxy Manager Web GUI.

You might need to deploy the docker-compose.yml file as root.

sudo docker-compose up -d

Once it is up and running open the Web GUI on port 81 and start configuring.

It is much nicer to configure the hosts this way than through the console.

NPM also supports automatic certificated generation and renewal from Let’s Encrypt. I still haven’t try this, but will do it pretty soon and will write about that experience.