posted 14 years ago
A domain name is nothing but an entry in the Internet's "telephone book" that the client's browser users to find the server's IP address. The "hosts" file is a local telephone book, so it can be used to lookup IP addresses for the machine on which it resides, but for the internet at large, the usual procedure is to use a Domain Name Server. DNS provides a more general database of domain names and addresses and it normally chained to upstream domain name servers which form a network that's headed by about 13 global DNS systems.
You'd register a domain name by purchasing the rights to it from a domain name registrar such as Verisign or GoDaddy.
Getting the "8080" off the URL is harder. DNS only resolves IP addresses, not port numbers. When a web browser makes a request to a server, if there's no port number in the URL and the selected protocol is "http", the port addressed will be port 80. For "https", it's 443. That means your Tomcat server must be accessible via those port numbers.
There are 2 ways to do that. One is to change the port settings in the Tomcat server.xml file. If Tomcat is the only webserver on that machine, it's the simplest way. Production machines often offer more than just J2EE services, so there's often a general-purpose server such as the Apache http server installed as well. For that case, a connector links the port 80 requests which go to Apache to the Tomcat server. By default the connection is made by Apache to Tomcat's port 8009.
There are 2 lesser-used options as well. One is to use a proxy server such as Squid. Basically, the proxy server is doing a scaled-down version of what Apache does. The other way, on Linux systems is to use the port translation feature of netfilter/iptables. Although netfilter is most commonly used as a firewall, it can also translate port and/or IP addresses so that you can leave Tomcat on port 8080, but the netfilter will route traffic targeting port 80 to it. I use a variation of this technique to allow my virtual machines to have public addressability.
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer