I have a web server running Apache and soon Tomcat. It is behind my firewall box so in order to grant access to various virtual host sites to the outside world I would need to use port forwarding on my firewall box. Given this situation, I presume my virtual hosts would have to be IP based in order to forward a particular iport to the web server? Does this mean that my web server box would need multiple IP addresses assigned to the NIC, and if so is there any easy way to manager this, or do I just have to add a new IP and virtual host everytime I create a new site?
It's not as complicated as it sounds. Forward all requests coming to port 80 to the single IP of the web server box. Use name based virtual hosting. The apache server will read the 'Host' http header sent by the client and serve up whichever site config matches that name. So if you have the correct ServerName directive, it will work just fine.
If my external ip address is say 123.456.789.123, then a visitor will get directed to 192.168.0.10:80... I already have name based virtual servers set up, say test1.dev and test2.dev both listening on 192.168.0.10:80. If an external visitor requests 123.456.789.123 I don't see how this can possible be translated to test1.dev or test2.dev. - the visitor can't specify which site they want, all they can specify is ip - hence my thought that forwarding to differnt ips on different ports...?
I'm sorry. I thought you had purchased a domain name for your IP. That would have made things much easier. You could simply add sub-domains as needed for free.
If your friends are techies, you could have them add test1.dev and test2.dev to their etc/hosts file (in both *nix and windows) and have them both point to your single IP (123.456.789.123). Then any browser requests will be made to the one IP but still still send different HTTP Host headers which Apache will see and serve up the correct site.
We're on the same page! I have hosting on Hostgator, but I also want to test things on my server that a few people could look at without putting it on my main hosting. I think I'll have to use ip-based hosting for non-techies, i.e. a different port on 123.456.789.123, and each port directs to a certain ip or port on the web server. Cheers!
Max, you can still host from your house as well as your service provider. You own the domain name maxmanders.co.uk, which means you can add sub-domains for free and point them to the IP at your house. Most providers provide some control panel to do this. You could create test1.maxmanders.co.uk and test2.maxmanders.co.uk and point them to your home IP. Then all will work like a charm.