I'm hosting my own website and email server at home on my own network. I have ports fowarded and working for the most part. I'm currently using namecheap.com dns servers and foward requests to my IP. I do have dynamic IP from ISP but it only updates when I switch mac addresses on my modem but I sill have IP updater just in case it changes. I'm running my own router - Sophos Home UTM. I conceptually a little confused on my situation. Should the router use the domain of my website and email for example its example.com. This gives every computer localhost.example.com. Or should I leave it with default or nothing? Is this important having my router host name include FQDN so router.example.com? I want to add more servers(vm servers for other things) and be able to use subdomains to call on them from outside of my network. For example I have ports 80,443,25, and 143 to one server. I want to add another server for other stuff. I want to redirect it by subdomin and not have to use NAT foward something weird like this, example.com:9999. Any suggestions? If this isn't a site for this questions let me know where to go thanks for any help.
Is this important having my router host name include FQDN so router.example.com?
Usually setting a domain on your router to
example.com make all the HOST only requests on your network (e.g. ping
somehostname) try to ping
somehostname.example.com. This might be useful if you are running one domain only, but is not related or required by what you are trying to accomplish.
I want to redirect it by subdomin and not have to use NAT foward something weird like this, example.com:9999. Any suggestions?
For this the usual way to accomplish this would be to setup internet facing http proxy server (such as nginx) which has 80,443 ports forwarded to it on the router. This proxy would be configured to proxy requests to specific webservers on the network. To explain it a bit better:
- You setup website for
example.comon webserver1 (192.168.1.1)
- You setup website for
example.neton webserver2 (192.168.1.2)
- You setup nginx on webserver3 (192.168.1.3) to which you forward 80 and 443 ports.
- You configure nginx to handle requests for all the domains and proxy them to respective web servers:
example.comwill be proxied to webserver1 (192.168.1.1)
example.netwill be proxied to webserver2 (192.168.1.2)
Also, as a sidenote, it's usually a better idea to have these servers in the DMZ instead of port forwarding. In that case, if the servers would get hacked, they would still be unable to access the local area network the server is in.