How to make custom subdomains with openwrt router

in advance i apologize for my ignorance of networking, i am very new to it.
my situation:
i have an openwrt router with many DHCP clients behind it. the router itself is a DHCP client to my ISP.
for the sake of the argument lets say i own the domain “”.
i have redirected the @ option in my domain name provider to the DHCP address provided to my router by my ISP.
i have an http server, that with my port forwarded, people outside my house can connect to it using “”.

my question:
i want to have 2 different http servers in my house, both on port 80, and on different machines. lets name these machines comp1 and comp2 for arguments sake. how can i make my own subdomains to where these servers can be accessed externally via “” and “”?
in other words, i want to use subdomains in the same way i’d use ports so that other people have to specify in a different subdomain for each of my services instead of a different port.
if such a thing is even possible.

Did you buy a router with openwrt on it, or did you flash it yourself? And what version are you using? And router make/model?

Yes this is possible, install nginx on your router and do name-based virtual host reverse proxying with proxy_pass and proxy_set_header.

1 Like

i flashed my TP-LINK ARCHER C7

would that work for any service? or just http?

It does technically support protocols other than http/https but they aren’t arbitrary ones like your minecraft server, they’re memcached, fastCGI, etc. For those just setup normal port forwards.

1 Like