NGINX: Installing Proxy Manager in LXC

Rahul Rao
5 min readAug 11, 2023

--

Feb 2024 update: There is an update to this guide that can be found here:

If you wish to use Alpine Linux, or otherwise use this guide for reference, continue on below. Otherwise, I highly recommend using the guide linked above.

We all know the feeling… set up your shiny new service, it FINALLY runs!!!! after shaving off a cool 6 months of your life expectancy trying to get the damn service to start up. You’re hyped up, type in the IP address, hit enter and… oh…

Now… don’t get me wrong your if you go to advanced > continue your service should work normally. But you will forever and always see the “site not secure” warning in the URL bar, and personally, I would rather share overseerr.myserver.some-ddns.org over http://192.168.12.13:5055 to my family any day! (separate guide on how to install that coming soon :)

Plus, if you choose to expose any service behind your router to the internet, a reverse proxy is necessary for proper security, and NGINX proxy manager makes this a breeze too. Note: Exposing services is risky and should not be done without proper configuration, the likes of which, will not be covered in this guide.

What is a reverse proxy?

To understand a reverse proxy better, let’s see how a proxy works. In simple terms, a proxy is an intermediary that connects your device to the internet (or any other device). It looks like this:

Credit: Cloudflare (https://www.cloudflare.com/learning/cdn/glossary/reverse-proxy/)

VPNs are similar to proxies. They do the same things however VPNs are encrypted so nobody can see what is going through your connection.

So a reverse proxy is simply… the inverse of a proxy. It allows the internet to access services in your network.

Credit: Cloudflare (https://www.cloudflare.com/learning/cdn/glossary/reverse-proxy/)

For more information, Cloudflare has a great article on how reverse proxies work here. For now, lets jump in to the installation!

Requirements

  • Proxmox fully installed and configured and access to GUI
  • Access to router control panel to set static IP address and basic knowledge of static IPs, DHCP ranges.
  • Basic knowledge of the terminal (opening, saving files etc.)
  • Basic Proxmox container knowledge (downloading LXC templates, setting up containers etc)

Preparation

NGINX proxy manager uses Docker by default. But… I’m an LXC guy so we’re going to take the path less travelled using Alpine Linux and this helpful guide by Max Kulik.

Downloading Alpine Linux LXC template:

In newer versions of Proxmox (I’m using v8), the container template list only gives us version 18 of Alpine. However, we need version 16, so we are going to have to download it manually.

  1. Go to the storage where you store your container templates. For me this is local
  2. Click on download from URL. You should see something like this:

3. Enter the following URL:

http://download.proxmox.com/images/system/alpine-3.16-default_20220622_amd64.tar.xz

4. Query the URL and download the LXC template

Creating the container:

Create a container using the Alpine template. The proxy manager does not use much resources so it can be pretty small. For reference I used:

  • 1 CPU
  • 1 Gb RAM / 512 Mb Swap
  • 8 Gb Boot disk

Make sure the container has a static IP address (for more information see Setting a Static IP address section of this guide). This is important for the rest of the set up later.

Now start the container and we are ready to install.

Installation:

First update all packages:

apk update && apk upgrade

Add a user called npm you can leave the password blank:

adduser npm

Install an editor of your choice. Here I use nano :

apk add nano

Then run the install script:

sh -c "$(wget --no-cache -qO- https://raw.githubusercontent.com/ej52/proxmox/main/install.sh)" -s --app nginx-proxy-manager

Once the install finishes you should see a success message:

Before you visit the URL we need to make some small modifications.

Configuration:

We need to modify one line in the NGINX configuration. Use the text editor you installed earlier to open the file:

nano /usr/local/openresty/nginx/conf/nginx.conf

There, comment out the line that says pid /run/nginx/nginx.pid;It should be somewhere near the top of the file. Then save, exit and reboot the container.

Once rebooted, visit the IP address that was displayed in the success message. You should see a login screen. Log in with the following credentials:

Email: admin@example.com
Password: changeme

Upon first login, it will prompt you to update your user information and change your password. Now NGINX proxy manager is up! But we have one more step to get those nice clean URLs :)

Getting clean URLs

We need a domain that points to the IP address of our NGINX container. Luckily for us, many free services exist that can be used for this purpose. I will be using Duckdns today.

Go to the provider of your choice, add a new domain (in my case xyz.duckdns.org ) and point it to the IP address of your NGINX container and not the public IP address of your home network. Once all is set, you can test the connection by going to yourdomain.some-ddns.org:81 and this should take you back to the login page.

If all works well then everything is set up correctly and you are good to go!

Note: In order to remove the port number from the end of the URL above, and obtain truly clean URLs with https . It is necessary to set up NGINX hosts. Refer here to do that.

Credit:

As mentioned earlier, this guide was very helpful. There are some github issues that can be useful for debugging purposes and I have also linked the repository here.

Disclaimer:

This is not a guide for setup in production or business environments. Please do your own research first for public or production environment setup.

I am not an IT professional. I am not tech support. I am a college student with a server. You are ultimately responsible for any commands you run on your system.

If you have any questions, leave a comment. Enjoy!

--

--

Rahul Rao

The cup is always entirely full. Half water, half air.