Skip to main content

Command Palette

Search for a command to run...

Part 6: Nginx Reverse Proxy for Clean URLs

Updated
2 min read
Part 6: Nginx Reverse Proxy for Clean URLs

Welcome to Part 6 of the Ubuntu home lab series. Now that we have several apps running on different ports, it’s time to simplify access using Nginx as a reverse proxy. This lets us use URLs like http://jellyfin.myserver.home instead of IP:port combos.

🧠 Tip: Use your router or hosts file to map custom domains (e.g., myserver.home) to your server’s IP.


🌐 Step 1: Install Nginx

sudo apt update
sudo apt install -y nginx

Check if it’s running:

sudo systemctl status nginx

I decided to install Nginx locally on the server as it would be able to access port 80 of my server and route traffic to various apps/containers.


📁 Step 2: Set Up Config Directory

sudo mkdir -p /etc/nginx/conf.d

📝 Step 3: Create Reverse Proxy Config

sudo nano /etc/nginx/conf.d/myserver.conf

Add entries like the following for each service:

Jellyfin

server {
  listen 80;
  server_name jellyfin.myserver.home;

  location / {
    proxy_pass http://<your-server-ip>:8096;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
  }
}

This will map http://jellyfin.myserver.home to http://<your-server-ip>:8096

Repeat similar blocks for other apps:

PostgreSQL (pgAdmin)

server {
  listen 80;
  server_name postgres.myserver.home;

  location / {
    proxy_pass http://<your-server-ip>:9876;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
  }
}

Node-RED

server {
  listen 80;
  server_name nodered.myserver.home;

  location / {
    proxy_pass http://<your-server-ip>:1880;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
  }
}

Homarr

server {
  listen 80;
  server_name dashboard.myserver.home;

  location / {
    proxy_pass http://<your-server-ip>:7575;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
  }
}

🔍 Step 4: Test and Apply Nginx Config

1. Test configuration:

sudo nginx -t

2. Restart Nginx:

sudo systemctl restart nginx

🧭 Step 5: Add Hostname Mapping (on client machines)

Edit /etc/hosts (on Linux/macOS) or C:\Windows\System32\drivers\etc\hosts (on Windows) and add:

192.168.1.100 jellyfin.myserver.home postgres.myserver.home nodered.myserver.home dashboard.myserver.home

Replace 192.168.1.100 with your server’s actual IP.

Now you can access:

  • http://jellyfin.myserver.home

  • http://postgres.myserver.home

  • http://nodered.myserver.home

  • http://dashboard.myserver.home


✅ Final Notes

Your home lab is now:

  • Secure and hardened

  • Running in containers

  • Easily accessible via custom URLs

You can keep extending it with apps like Kavita, FreshRSS, Calibre-Web, or even GitLab. Just follow the same Podman + volume + Nginx proxy pattern.

Thanks for following along! 🧑‍💻

Feel free to share your thoughts or improvements at artofcoding.dev!

Ubuntu home lab for developers

Part 1 of 6

This blog series guides you through setting up a secure, containerised, developer-friendly headless Ubuntu home server—from OS install to deploying self-hosted services with Podman. Perfect for devs and homelab enthusiasts alike.

Up next

Part 5: Advanced Containers – pgAdmin, Node-RED, and Homarr

Welcome to Part 5 of the Ubuntu home lab series. This part expands on our Podman setup by deploying more advanced services inside containers. We’ll run PostgreSQL with pgAdmin in a shared Pod, Node-RED for workflows, and Homarr for a beautiful home l...