Reverse Proxy Manager on Raspberry Pi

I was looking for some time to easily manage the binding of multiple web application hosted in my docker host machine. I have found a good candidate in Nginx Proxy Manager from Jamie Curnow https://jc21.com

To best fit the installation, I rearranged the default setup for a fastest deploy in my environment based on PhotonOS and Portainer for Raspberry PI.

Base configuration

Open an ssh console and create a new folder where you store a configuration file. Note that “npm” means “Nginx Proxy Manager”.

mkdir /var/npm
nano /var/npm/config.json

Than paste the configuration parameters as follow.

{
  "database": {
    "engine": "mysql",
    "host": "db",
    "name": "npm",
    "user": "npm",
    "password": "npm",
    "port": 3306
  }
}

Enter into the Portainer UI, go to the Stacks menu and add a new stack.

Service stack creation

Choose a name for example “npm”, paste on the Web editor the script and deploy the stack.

version: "2"
services:
  app:
    image: jc21/nginx-proxy-manager:latest
    restart: always
    ports:
      # Public HTTP Port:
      - "80:80"
      # Public HTTPS Port:
      - "443:443"
      # Admin Web Port:
      - "81:81"
    volumes:
      # Make sure this config.json file exists as per instructions above:
      - /var/npm/config.json:/app/config/production.json
      - npm-data:/data
      - npm-letsencrypt:/etc/letsencrypt
    depends_on:
      - db
  db:
    image: mariadb:latest
    restart: always    
    environment:
      MYSQL_ROOT_PASSWORD: "npm"
      MYSQL_DATABASE: "npm"
      MYSQL_USER: "npm"
      MYSQL_PASSWORD: "npm"
    volumes:
      - npm-mysql:/var/lib/mysql

If all goes to the right way you should see your service up and healthy

Now you could proceed with the proxy configuration at the link http://<host-address>:81

Default credential

Email:    admin@example.com
Password: changeme

Complete your customization and good work!

Loading...

4 thoughts on Reverse Proxy Manager on Raspberry Pi

  1. Hello, I’ve followed a ton of guides to get this working on the Pi4 and I’m not having luck. The database runs just fine but I keep getting the error below in regards to npm’s container and it’s driving me mad. Any help you can provide will be great. I’m also running OMV on the Pi.

    Cannot parse config file: ‘/app/config/production.json’: SyntaxError: Unexpected token “ in JSON at position 71 Error: Cannot parse config file: ‘/app/config/production.json’: SyntaxError: Unexpected token “ in JSON at position 71

  2. Hi Carl,

    the /app/config/production.json maps from the container to the host path /var/npm/config.json or wherever you put your config.json file; so the problem is on this one. The issue could be a read permission or if you cut and paste the config from an html page pay attention to the characters sometimes the source code pages put exotic keycode. It happened also to me that what it should be as minus char “-“ was something else.

  3. 2 qeustions

    1. How would you configure to set this up with Mongo DB or switch between Mongo and MySQL?

    2. Can you or should you still install nginix locally to Ras-pi to use for development and testing of app creations on the local network before shipping it to the container directory and making it public? Or can this be used to manage both? If so how 🤔

    1. 1. At the moment Nginx proxy Manager support only MariaDb or Mysql; The opened issue at https://github.com/jc21/nginx-proxy-manager/issues/200 complains about using a less expensive database like sqlite but te PR is still opened.
      2. I still prefer to test in container, nginx proxy manager resolve the alias name so you could have you public container routed as mysite.com by the public dns that forward to the production container and still have a second container for testing as test.mysite.com, obviously you have to set a static dns into the file host or in your router to point the raspberry ip only from the local network.

Add Your Comment

* Indicates Required Field

Your email address will not be published.

*