- fixed public IP address,
- registered private domain f.ex.: sample.my,
- some web servers/services on LAN f.ex. raspian1(22.214.171.124) and raspian2(126.96.36.199).
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.
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.
I would recommend NGINX.
Thanks @pavelgl - these links helped for start.
I successfully installed nginx and configured it, by using this advice:
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?
Check if your ISP actually allows the connection, try telnet to the port you're using (80 or 443 ?).
My ISP allows it.
Before installed nginx I used port forwarding. Now those port forwarding configs are disabled.
You need to modify the firewall to accept connections to the corresponding port from the wan side.
Ah, my blind! Of course.
All is working as expected.
Thank you for your support!
Or run haproxy directly on the router. I am running several domain names as well as ssh on the same 443 port.
I am using nginx directly on the router too..
But it could be interesting to look on a "how to"...