How to Set Up Nginx Proxy Manager at Home

How to Set Up Nginx Proxy Manager at Home: Your Ultimate Guide to Self-Hosting Success

Welcome, fellow homelab enthusiasts and self-hosting adventurers! If you’re anything like us at OpenClaw, you love the freedom and control that comes with running your own services. But let’s be honest, managing multiple services on different ports, dealing with SSL certificates, and exposing them securely to the internet can quickly become a tangled mess. That’s where Nginx Proxy Manager (NPM) swoops in like a superhero, simplifying your entire setup.

In this comprehensive guide, we’ll walk you through exactly how to set up Nginx Proxy Manager at home, transforming your homelab into a streamlined, secure, and easily accessible powerhouse. Get ready to ditch those complex Nginx config files and embrace a user-friendly web interface!

What is Nginx Proxy Manager and Why Do You Need It?

At its core, Nginx Proxy Manager is a reverse proxy management system built on Nginx, featuring a beautiful and intuitive web interface. Think of it as the traffic cop for your homelab. Instead of directly exposing your services (like a Plex server, Nextcloud instance, or Home Assistant dashboard) to the internet, you expose NPM. NPM then intelligently forwards requests to the correct internal service based on the domain name.

Here’s why NPM is an absolute game-changer for your self-hosting journey:

  • Simplified SSL/TLS: Automatically obtain and renew free SSL certificates from Let’s Encrypt for all your services. No more manual certbot commands!
  • Centralized Management: Manage all your proxy hosts, redirections, and streams from a single, easy-to-use web interface.
  • Security: By acting as a reverse proxy, NPM hides your internal network structure and can add an extra layer of security.
  • Custom Domains: Easily use custom domain names for your internal services, making them much more memorable and professional.
  • Access Control: Implement basic authentication for services if needed.
  • WebSockets Support: Essential for many modern web applications like Home Assistant.

Prerequisites for Your Nginx Proxy Manager Setup

Before we dive into the installation, let’s ensure you have a few things in place:

  • A Server/Device: This could be a dedicated Raspberry Pi, an old PC running Ubuntu Server, a Proxmox LXC container, or a Docker-enabled NAS like a Synology DiskStation. We highly recommend using Docker for NPM as it simplifies deployment and updates.
  • Docker and Docker Compose: If you’re going the Docker route (which we strongly advise), ensure Docker and Docker Compose are installed on your server.
  • Domain Name: A custom domain name (e.g., yourdomain.com) is crucial for leveraging NPM’s SSL capabilities. You can get one from registrars like Namecheap or Google Domains.
  • Port Forwarding: You’ll need to forward ports 80 (HTTP) and 443 (HTTPS) from your router to the internal IP address of the server running NPM. This allows external traffic to reach NPM.
  • DNS Management: You’ll need access to your domain’s DNS settings to create A records or CNAME records pointing to your home’s public IP address. Dynamic DNS (DDNS) is essential if your home IP changes frequently. Services like DuckDNS or No-IP are great for this.

Step-by-Step: Installing Nginx Proxy Manager with Docker Compose

This is the recommended and most straightforward method for installing NPM.

1. Prepare Your Server and Docker Environment

Ensure Docker and Docker Compose are installed. If not, refer to Docker’s official documentation for your specific OS. Create a dedicated directory for NPM:

mkdir nginx-proxy-manager
cd nginx-proxy-manager

2. Create Your docker-compose.yml File

Inside the `nginx-proxy-manager` directory, create a file named `docker-compose.yml` (or `docker-compose.yaml`) and paste the following content. This configuration sets up NPM and a PostgreSQL database for its data.

version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: always
    ports:
      - '80:80'
      - '443:443'
      - '81:81'
    environment:
      DB_MYSQL_HOST: db
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: npm
      DB_MYSQL_PASSWORD: npm_password_secure # CHANGE THIS!
      DB_MYSQL_NAME: npm
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - db

  db:
    image: 'mariadb:latest'
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: npm_db_root_password_secure # CHANGE THIS!
      MYSQL_DATABASE: npm
      MYSQL_USER: npm
      MYSQL_PASSWORD: npm_password_secure # CHANGE THIS!
    volumes:
      - ./data/mysql:/var/lib/mysql

Important: Change the `npm_password_secure` and `npm_db_root_password_secure` values to strong, unique passwords!

Note: While the environment variables mention `DB_MYSQL_HOST`, NPM actually supports both MySQL and MariaDB. The `mariadb:latest` image works perfectly here.

3. Start Nginx Proxy Manager

From within the `nginx-proxy-manager` directory, run the following command:

docker compose up -d

This command will download the necessary Docker images and start your NPM and database containers in the background.

4. Access the Nginx Proxy Manager Web Interface

Open your web browser and navigate to `http://YOUR_SERVER_IP:81`. Replace `YOUR_SERVER_IP` with the actual IP address of the server running NPM.

You should be greeted by the Nginx Proxy Manager login screen.

Default Credentials:

  • Email: `admin@example.com`
  • Password: `changeme`

Immediately log in and change these default credentials! You’ll be prompted to do so on your first login.

Configuring Your First Proxy Host

Now that NPM is up and running, let’s configure your first service.

1. Update DNS Records

Go to your domain registrar’s DNS management page. Create an A record (or CNAME if using DDNS) for the subdomain you want to use. For example, if your domain is `yourdomain.com` and you want to expose your Home Assistant instance, create an A record for `homeassistant.yourdomain.com` pointing to your home’s public IP address.

If you’re using a DDNS service like DuckDNS, configure your router or a script on your server to keep your public IP updated with the DDNS provider.

2. Create a New Proxy Host in NPM

In the NPM web interface, navigate to “Hosts” > “Proxy Hosts” and click “Add Proxy Host”.

  • Domain Names: Enter the subdomain you just configured (e.g., `homeassistant.yourdomain.com`).
  • Scheme: Usually `http` for internal services.
  • Forward Hostname / IP: The internal IP address of your service (e.g., `192.168.1.100`).
  • Forward Port: The internal port your service is listening on (e.g., `8123` for Home Assistant).
  • Block Common Exploits: Enable this for added security.
  • Websockets Support: Enable if your service uses WebSockets (e.g., Home Assistant, Jellyfin).

3. Enable SSL (Let’s Encrypt)

Go to the “SSL” tab:

  • SSL Certificate: Select “Request a new SSL Certificate”.
  • Force SSL: Enable this to automatically redirect HTTP traffic to HTTPS.
  • I Agree to the Let’s Encrypt Terms of Service: Check this

Comments

Leave a Reply

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