Domain name to `IP:port` resolution

Hello,
I have a few services running on my local network, but most share the same machine. I'd like to make it so when I put http://mycoolservice.lan in the browser, I can be redirected to that specific port like 192.168.10.1:8000.

Before I got OpenWRT I managed to do it with Nginx Proxy Manager - it has a nice GUI to set it up. I wonder if there's any easy way to do the same thing in OpenWRT?

You can install NGINX on OpenWrt.

Or apache.

1 Like

I installed nginx-mod-luci but I have no idea what to do next. Should I have anything menu on LuCI? Or do I manually set it? And if so - how?

I really tried but I think I can't do it.
I've managed to install the nginx but it cannot start because ports :80 and :443 are occupied by uhttpd.

So far I managed to figure uhttpd is a basic http server - and that's where we serve LuCI. Now, there's luci-nginx package, but I don't know if installing it wouldn't just lock me out from access to LuCI.

I assume I need to somehow first disable the LuCI I have right now before installing the luci-nginx first?

Tell uhttpd to only bind to the router's LAN IP.
By default it binds to all interfaces.

Edit /etc/config/uhttpd.

1 Like

I found this file and I saw that it states what port uhttpd runs at too... So I just moved it to some :10080 instead.

I don't know how, but after doing it, I can still reach LuCI from under default gateway 192.168.1.1. I think that's the luci-nginx magic is doing? But anyways - my LuCI is still alive and I can add my own .confs to the nginx so I think it's all good!

tl;dr:

  1. Get luci-nginx
  2. Go to /etc/config/uhttpd, set the ports to something else than 80 and 443.
  3. Restart uhttpd either through LuCI (System > Startup > Restart where uhttpd is) or just from ssh.
  4. Restart nginx either through LuCI (System > Startup > Restart where nginx is) or just from ssh.
  5. Try to reach your router in the browser and see if LuCI is still up.
  6. Don't panic if it isn't - you can just change the ports back to 80 and 443 in the uhttpd

Remember that nginx is probably not running after trying to bind to :80 and :443 so you want to restart nginx after the change in uhttpd as well.

Once you have this, you should be able to google some examples of proxy nginx configs to see how it can be done - that's what I'm doing right now.