Setting up the NGINX Proxy Manager on the Raspberry Pi

In this project, we will walk you through setting up the NGINX reverse proxy manager on your Raspberry Pi.

Raspberry Pi NGINX Proxy Manager

The NGINX proxy manager is a useful tool that simplifies the process of setting up a reverse proxy on your Raspberry Pi.

There are various reasons why you might want to set up a reverse proxy on your Raspberry Pi. The number one reason would be to expose a service to the internet and allow you to quickly implement HTTPS.

For example, if you set up a service that doesn’t support HTTP, you can make it route through the NGINX reverse proxy instead. This reverse proxy can then accept HTTPS requests, which are then forwarded to the less secure program.

Setting up a reverse proxy on your Raspberry Pi also makes running multiple applications simpler.

Over the following sections, we will show you how to get the NGINX reverse proxy manager running on your Raspberry Pi using Docker.

Equipment

Below is a list of the equipment we used to set up the NGINX Proxy Manager on the Raspberry Pi.

Recommended

Optional

This tutorial was last tested on a Raspberry Pi 400 running the latest version of Raspberry Pi OS Bullseye 64-bit.

Installing the NGINX Proxy Manager on the Raspberry Pi

This section will cover all of the steps required to get your Raspberry Pi working as a reverse proxy. We will be achieving this by using a piece of software called the NGINX proxy manager.

We chose this software as it allows you to set up multiple reverse proxies on your Pi easily.

These initial steps will be run entirely within the terminal, so ensure you have that open before continuing. If you are using a desktop flavor of Raspberry Pi OS, you can bring this up by pressing CTRL + ALT + T on your keyboard.

Preparing your Raspberry Pi to run the NGINX Reverse Proxy Manager

1. Before we get started, we must ensure that our Raspberry Pi is set up to run the NGINX proxy manager.

Our first step in this process is to ensure our package list is up-to-date and any out-of-date packages are upgraded.

You can achieve both tasks by using the following command in the terminal.

sudo apt update
sudo apt upgrade -y

2. After the upgrade is complete, your next step will be to install Docker to the Raspberry Pi.

Please follow the guide we linked above before continuing with this tutorial. Our Docker guide will get the software running correctly on your device.

3. Once you have Docker installed, we can continue with the next few steps.

We now must create a folder to store the Docker compose file. Create a directory named “nginxproxymanager” on your Raspberry Pi by using the following mkdir command.

mkdir ~/nginxproxymanager

Using the tilde symbol (~) at the start of the path tells the system to create this folder within the current user’s home directory.

4. After creating the new directory, you should change into it using the cd command.

cd ~/nginxproxymanager

Writing a Docker Compose File for the NGINX Proxy Manager

5. We can now proceed with installing the NGINX proxy manager.

Since we will be running this reverse proxy service on our Raspberry Pi using Docker, we will want to create a Docker Compose file. A compose file is like a set of instructions for Docker so that it knows how to start up the specified container.

Begin writing this file using the nano text editor by using the command below in the terminal.

nano docker-compose.yml

6. Within this file, type in the following lines.

While you can also set up a MariaDB or MySQL server alongside the NGINX Proxy Manager, we will rely on SQLite. SQLite doesn’t require a separate server and should be fast enough for most people’s needs.

version: '3.8'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

7. After adding the above lines, you can save and quit by pressing CTRL + X, followed by Y, then ENTER.

Starting the NGINX Proxy Manager on your Raspberry Pi

8. We can now start the reverse proxy manager on the Raspberry Pi using the following command.

By using the “-d” option, we are tell Docker that it should from the current terminal session when it launches the container.

docker compose up -d

This process may take a few minutes to complete as it needs to download all of the components of the container.

Using the NGINX Proxy Manager on the Raspberry Pi

Now that we finally have the NGINX Proxy manager running on the Raspberry Pi, let us put it to use.

Thanks to this software, you will soon see how simple it is to set up a reverse proxy on your Raspberry Pi.

Accessing the NGINX Proxy Manager Web Interface

1. The NGINX Proxy manager is configured entirely through its web interface. To access this interface, you must first know the IP address of your Raspberry Pi.

The easiest way to get your Raspberry Pi’s IP address is to use the hostname command.

hostname -I

2. Once you know your Pi’s IP, go to the following address in your favourite web browser.

Ensure you replace “<YOURIPADDRESS>" with the IP for your Raspberry Pi.

http://<YOURIPADDRESS>:81/

Initial Setup Experience

3. You will be greeted by the following screen asking you to login. NGINX Proxy Manager has a default login you must use for your initial log in.

For the username, type in “admin@example.com“. For the password, type in ” changeme” (1.).

After filling out the default password, click the “Sign In” button (2.).

Sign in to new account

4. Upon logging on for the first time, you must fill out the details for your new user (1.).

After updating the details, click the “Save” button (2.).

Change user details

5. Next, you must set a new password for your account. Start by entering the current password (1.), which will still be “changeme“.

You will then get to fill out a new password for your account (2.).

To confirm your new password, click the “Save” button (3.).

Set new password for account

Creating your First Reverse Proxy on the Raspberry Pi

6. You now have the NGINX reverse proxy manager running on your Raspberry Pi. While we won’t be covering the exact steps of setting up a reverse proxy, let us show you where to find the option.

In the top menu, you must click the “Hosts” button (1.). This will bring up a drop-down box listing the different types of proxies you can set up on the Pi. To proceed, click the “Proxy Hosts” option (2.).

Open Proxy Hosts screen

7. You will now be on the proxy hosts page. Currently, there will be nothing here. Click the “Add Proxy Host” button to proceed.

Open add Proxy host

8. You can now use this dialog box to set up all of the details for the reverse proxy on your Raspberry Pi.

This allow you to set the domain name or names, the HTTP scheme, hostname/IP, and the port you are pushing through your proxy.

You can also tell the NGINX Proxy Manager to generate an SSL certificate for your domain name using this same dialog.

Once you are happy, click the “Save” button to proceed.

NGINX Reverse Proxy Manager on the Raspberry Pi

Conclusion

Hopefully at this point you will now have the NGINX Proxy Manager set up and running on your Raspberry Pi.

This software makes running reverse proxies on your Raspberry Pi a far simpler process. A reverse proxy can help set up faster and more secure access to software on your device.

Please leave a comment below if you need help getting this software to run.

If you found this tutorial useful, check out our many other Raspberry Pi projects.

2 Comments

  1. Avatar for JLuis
    JLuis on

    Hello. A question:
    In the docker-compose.yml file, where is the SQLite database? Or is it not necessary to include it?
    Thank you

    1. Avatar for Emmet
      Emmet on
      Editor

      Hey JLuis,

      SQLite is serverless so it’s all within the one container. The SQLite database file will be stored within the mounted “./data” directory.

      Cheers,
      Emmet

Leave a Reply

Your email address will not be published. Required fields are marked *