Hi,
I have:
fixed public IP address,
registered private domain f.ex.: sample.my,
some web servers/services on LAN f.ex. raspian1(162.168.1.101) and raspian2(162.168.1.102).
What I want is:
reach my local web services from WAN by calling them rsp1.sample.my and rsp2.sample.my
Is it possible to achieve functionality described above?
If yes - are there any samples/links?
Or what keywords should I search/study for?
Thanks in advance.
frollic
September 25, 2022, 10:32am
2
Would be easier if you separated them by using different ports.
sample.my:1234 -> rsp1
sample.my:4321 -> rsp2
Ah, that I know
That's easy by using port forwarding, but I would like to use subdomains.
You will need to use a reverse proxy to do this. The actual (sub) domain names do not factor into routing decisions if you only have a single public ipv4 address. The router doesn’t see any information about the domain/subdomain request, only that packets have arrived on the interface with a certain destination port.
A web server with reverse proxy configured, however, can see that the http/https requests do contain subdomain requests. From that, a reverse proxy can appropriately redirect the packets to the desired server.
3 Likes
pavelgl
September 25, 2022, 1:34pm
5
3 Likes
Thanks @pavelgl - these links helped for start.
I successfully installed nginx and configured it, by using this advice:
domain-name, openwrt
It is working very well from LAN, but not from WAN (Unable to connect).
Now I am no stuck on this.
Which parts of openwrt configs could I check?
frollic
September 25, 2022, 8:05pm
7
Check if your ISP actually allows the connection, try telnet to the port you're using (80 or 443 ?).
1 Like
My ISP allows it.
Before installed nginx I used port forwarding. Now those port forwarding configs are disabled.
pavelgl
September 25, 2022, 8:44pm
9
You need to modify the firewall to accept connections to the corresponding port from the wan side.
1 Like
Ah, my blind! Of course.
All is working as expected.
Thank you for your support!
tboege
September 26, 2022, 6:45am
11
Or run haproxy directly on the router. I am running several domain names as well as ssh on the same 443 port.
1 Like
I am using nginx directly on the router too..
But it could be interesting to look on a "how to"...