Web Server Hosts File Example

Today I been looking around for a sample hosts file configuration to setup a web server hostname correctly.  Unfortunately I was unable to find such, there for I decided to learn about it and come up with my own sample configuration of what a hosts name should look like.

Here it is:

Format:
<IP> <HOSTNAME>.<DOMAIN> <ALIAS>
  • IP: the static network IP address you configure on your computer.
  • Hostname: the name you give your server when installing the operating system (like Ubuntu or Windows)
  • Domain: This is the registered domain name you plan to host in your web server (The name of the website example.com)
  • Alias: Similar to the hostname
Example:
127.0.0.1 localhost.localdomain localhost

This will change the hostname to what you want:

#hostname hostname.domain.com

 

Comments

So empty here ... leave a comment!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Sidebar