File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Linux / UNIX and the fly likes Setting hostname for web server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Setting hostname for web server" Watch "Setting hostname for web server" New topic

Setting hostname for web server

David Perry

Joined: Dec 12, 2003
Posts: 19
Hi all. I'm fairly green (I suppose that's evident by my post topic), however, I'm setting up RedHat 9 on a machine to use as a server to host a web site for personal use/learning, using the www address I have registered. My question is, what do I enter for the Hostname configuration when prompted during the installation? Is it or just (or something else)? Any help and advice would be greatly appreciated.

Thanks in advance for your help. David.
Dean Jones

Joined: Jun 10, 2004
Posts: 6
Your hostname can be anything you like. If this is just a local box, name it according to how you want to access it. However, if this box is on a network with a DNS server, then you can name it whatever you want.

For instance, my server is named "tookie". However, in DNS, it's "" and "". If you log onto that box and run 'uname -h', you'll get back "tookie". Because that's its local name. Everyone using DNS to resolve the host name will get the IP of tookie back.

So, if you're setting up a little web server just for your own use, name the box what you want to. You can add extra entries in the /etc/hosts file to accomidate what you want to access your web server with. For instance:

Then you can pull up your web browser and type in any one of those names and your web page will pull up from your local box.

If you're wanting other people to access this box over the internet and they will be accessing it via, then who ever you registered your domain name with, you'll need to go there and assign that domain name with your IP address. The, you can still call your box whatever you want. However, the people accessing it from over the internet will be hitting it by whatever you assigned in DNS.
David Perry

Joined: Dec 12, 2003
Posts: 19
I really appreciate your feedback; you totally cleared that up (localhost vs. DNS). I do want to allow access to the site over the internet, so DNS is the direction I'm going, which leads me to the following:

I have a book (Linux Administration Beginner's Guide) which is pretty lean on the DNS material, however, it mentions using BIND. Is this the way to go for DNS, or is there something else I should be looking into? How can I check if DNS functionality is already installed on my machine (Red Hat 9)? Can you recommend any good reference material/sites that explain how to set up and configure DNS on Red Hat?

Thanks again for your help. David.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

You need a DNS if YOUR BOX acts as nameserver.
But to be found from others, foreign namesers add your servername and ip to their DNS-records.

To manage a small intranet of 3-4 hosts, I would prefer to manage name-ip bindings with the '/etc/hosts' - file.

Of course you have to check, whether your favorite name is in use, and can't name your machine '' or ''.
David Perry

Joined: Dec 12, 2003
Posts: 19
Okay, let me see if I understand this correctly; I'd have to set up DNS if my server was managing an intranet with servers below it (subdomains?!?!)? However, for my purposes (setting up a single server with the sole purpose of hosting a web site that can be accessed by others over the internet) DNS is not necessary?

Also, on the point of the domain name, is there a difference between naming the domain or,
and which method is prefered/better?

Thanks again; I really appreciate the feedback I've gotten. Best regards. David.
Consider Paul's rocket mass heater.
subject: Setting hostname for web server
It's not a secret anymore!