馃摎 Reference guide

Nginx Reverse Proxy on a Proxmox Host: LAN-Only with Basic Auth

A compact walkthrough for fronting several homelab services with one Nginx proxy, restricted to the LAN and protected by basic auth.

AI-compiled from the author鈥檚 homelab notes. Adjust addresses and names for your own network.

Summary

One Nginx instance routes friendly hostnames (home.lan, vault.lan, and so on) to services running in containers and VMs, and only answers to the LAN.

Setup

  1. Install: apt-get update && apt-get install -y nginx apache2-utils.
  2. Create the auth file with a strong, unique password: htpasswd -c /etc/nginx/.htpasswd youruser.
  3. Create /etc/nginx/sites-available/proxy, symlink it into sites-enabled/, then test and reload:
    nginx -t && systemctl reload nginx
    
  4. Restrict and authenticate inside each server block:
    allow 192.0.2.0/24;
    allow 127.0.0.1;
    deny all;
    auth_basic "Homelab";
    auth_basic_user_file /etc/nginx/.htpasswd;
    
  5. Route by hostname with a map on $host, pointing at backends such as http://192.0.2.50 or https://192.0.2.103:8000. $host is the name without the port. $http_host keeps a port when the browser sends one, so a map on it misses vault.lan:443. Separate server_name blocks do the same job.

Pitfalls

Spot something wrong or outdated? Leave a comment below. Every comment is reviewed to keep these posts accurate.

By commenting, you agree to our Terms of use and confirm this is your own work. Short quotes are fine with a credit and link. Copied, unsafe, or abusive comments are removed. See something copied? Say so here.