should I / can I put a production web server behind a router

I’m in the process of upgrading my cable internet connection to a commercial account, and I’m moving my web server from a datacenter to my virtualization server at my house. I’m trying to figure out how I’ll set this up because I also run a linux router virtually to put my home network online.

should I run the virtualmin web server behind the router? if so, how would I set up port forwarding for dns? I believe dns is udp, so would I just set it to forward tcp and udp to the server on port 53? or should look for a company to host the dns for me? possibly even more important, would the web server being on a local lan ip (not a public ip) cause any possible problems for php scripts already running on websites? I’m afraid it wouldn’t be able to see the servers public ip.

my other option would be to get a second static ip, but I’m not sure what the cost is yet. it may or may not be an option, depending on the price.

I hope my questions make sense. it is an important project and not much time to get it done.

While operating a hosting server behind NAT is sure possible (yes, forwarding port 53 should be sufficient to operate DNS), it includes additional hassle and configuration issues. There are several places in Virtualmin where you need to take special care of NAT situations.

So basic question is: Why exactly would you prefer a home NAT over the datacenter solution, especially for “important projects”?

To operate DNS at your home place, you do need a static external IP address. Exception is if you have a dynamic external “administrative domain” pointing to your home place, which is not recommended though due to possible caching of outdated IPs.

To PHP scripts it should not matter if they’re running on private IPs behind a NAT or on public ones, since usually you don’t communicate directly with IP addresses in web software, but with hostnames. Whether or not you need to take any precautions there depends entirely on the concrete situation.

I personally would - if I have the chance and choice, always prefer a datacenter with a fast connection and static IPs over home NAT.

good question. datacenter is the way to go, and only an idiot would run important websites on a home cable modem. not to worry, once things are set up right, I’ve had my server run for years at a time without going down, except for a reboot now and then. a linux router in a vm works great for me. anyway, to sum it up quickly, my jerk of an internet provider says I use to much bandwidth, so I have to switch to commercial cable internet. it costs more but has fewer restrictions. my internet bill will double, so to cover that cost, I’ll get rid of the datacenter server and cpanel. the server doesn’t use a huge amount of bandwidth anyway.

the good news for me is that extra static ip’s wont cost me any extra money, BUT… one reason why I wanted to run the server behind my router is so I can configure bandwidth throttling/QoS, and give it a slightly higher priority over the rest of the home network.

I think I should make a pros/cons list for NAT or static public ip for the server. I keep leaning in the direction of NAT, but I most likely will go the other way with the public ip.