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
- Install:
apt-get update && apt-get install -y nginx apache2-utils. - Create the auth file with a strong, unique password:
htpasswd -c /etc/nginx/.htpasswd youruser. - Create
/etc/nginx/sites-available/proxy, symlink it intosites-enabled/, then test and reload:nginx -t && systemctl reload nginx - Restrict and authenticate inside each
serverblock:allow 192.0.2.0/24; allow 127.0.0.1; deny all; auth_basic "Homelab"; auth_basic_user_file /etc/nginx/.htpasswd; - Route by hostname with a
mapon$host, pointing at backends such ashttp://192.0.2.50orhttps://192.0.2.103:8000.$hostis the name without the port.$http_hostkeeps a port when the browser sends one, so a map on it missesvault.lan:443. Separateserver_nameblocks do the same job.
Pitfalls
- Check the protocol each backend speaks. An HTTPS-only service behind an
http://upstream gives 502. - Always verify reachability from the proxy host itself, not your laptop.
- Never pass the password on the command line in shared shells (
htpasswd -bstores it in history); prefer the interactive prompt. - Add TLS before exposing anything beyond the LAN.
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.