I'm a little bit lost in options I should enable in the Openwrt: firewall rules? Nginx settings?
My issue:
From the WAN side, I wish to access to several webservers (subdomain1.myname.com, subdomain2.myname.com, ...) that are host on different PC, but on Openwrt device. Those PC are on the LAN side. I order to do that, I installed a reverse proxy (Nginx). Even with one subdomain only, it doesn't work
Or should I to point to "device" instead of "lan". And in this case, it is the job of the router to redirect the request to the local physical PC in the LAN.
Any help is greatly appreciate
Thanks in advance, BR.
If you have IPv6 working in your LAN then you can access your servers directly without using proxy.
When your router is not reachable over IPv4 (please confirm) there is no point in configuring IPv4 rules.
If you're lucky to have a public IPv4 address on your ADSL box, check if you can reconfigure it into a bridge mode. In either case you will need an Accept Input rule for TCP ports used (assuming you're running proxy on the router).
The nginix process running on your router receives all web requests, then forwards them by opening a userspace connection to one of the servers on the LAN. So the firewall rule needs to be an input from wan rule, not a forward.
Testing must be done from a separate Internet connection. Reaching your own public IP from inside the LAN is not the same.
@AndrewZ Yes, I have IPv6 in my LAN, and yes, it should be reachable in theories (if the configuration of my OpenWrt is OK :))
My router isn't reachable in IPv4, just CGNAT (with few ports opened that I don't know the range); maybe it is to be compliant with IPv4 flow? The ADSL box can't be used as a bridge. It is a proprietary box with the minimal features; one useful feature is that I can place my router in a DMZ.
I will try to test an access to my personal webserver with IPv6 protocol only. That wasn't my plan because eveytime I changed my provider, I should have to re-configure my local network
I have a question about the firewall rules. How to configure it in order to have an access to local server? Is it with the configuration "rule.png" or "rule1.png" on this first screenshot
(Sorry, I can send only one picture):
In the first case, the flow comes from the "wan" towards the "lan". In the second case, the flow comes from the "wan" towards the "device". Note that the firewall is configured with default settings (default.png.png)
What do you mean? At the time being, I just write subdomain1.myname.com in Firefox without success. Nevertheless, as explained, I can reach my router on port 8080.
And to answer to @mk24 , I test the connection with my laptop (inside my LAN) and with my mobile too (outside my network).
I am not sure to understand! I can't remove IPv6 because my router is reachable through IPv6.
".123" isn't my WAN IP, it is the LAN IP of my server.
I just understand to remove the port in "From".
I have now a configuration that seems to work thanks to your all exchanges. Nevertheless, I don't know if it is through Nginx engine or thanks to IPv6 route.
I will check deeply and provide you my feedback before to close the topic.
Thank you all
I mean, before fighting nginx to make sure SNI works (and it does, it's nearly impossible to break), make sure you can actually reach that port (from outside), follow @mk24's instructions.
This may be way off-base, but when you're accessing it from the WAN side, what DNS server is providing the ip address pointing at your home network? Or have you hard-coded the IP in the hosts file on your PC?
@AvverbioPronome , yes and mainly, it should be thanks to instructions provided by @mk24 that I can now reach my webserver. I will test few changes and with a reboot of the box and router both, and I will provide you what I think is a "solution". Maybe not the best but something that works at least
But because I made few changes in the firewall's setting, I will appreciate a feedback of experts because we speak about security . If I open everything, that have no sense!
@martindholmes This is a great detail I forget to mention
I buy my FQDN (myname.com in my example) and set the server's address in the interface they provide me. The full name of my server (subdomain1.myname.com) is written in the files "/etc/hosts" of my Linux laptop.
That is the cost to have an access to my website that is in fact a website that hosts my personal notes. For other webservers, maybe I will set-up a VPN if I am on the WAN side.
access from the LAN (laptop) and from the WAN (mobile phone outside the network) both
I conclude that a full configuration to access to my personal webserver and using Nginx is:
A proper .conf file as per @AvverbioPronome 's recommandations (thank you!): location / { ... }. That implies this bloc is set in the .conf file otherwise Nginx detect a conflict:
I will learn the TLS and proper hardening later I will finished an installation that allow to access to my personal webserver. I will also install fail2ban on my router, but not now because I am afraid to ban myself