Installed apache 2 in my Ubuntu server and I use many web application like osc, glpi.

To browse these applications I have to write @ip/glpi in browser. my purpose is to use servername instead of ip address.

What is the way to do this action

System info:

Ubuntu 11.10

PHP 5.3.6

Apache 2.2.20

MySQL 5.1.67

  • If you're using this in a local environment, the 2. way of Dave's answer is the simplest to go. Mar 15 '13 at 14:51

You need to provide a hostname for the server host.

Typically you can do this one of three ways:

1 Through a DNS Zone

If you have control of the DNS server for your LAN (assuming you only want external access; or control of a domain/zone DNS server for wider Internet access) you can add a host (A) record pointing a given name to the IP address.

2 Through Locally-Defined Hosts

On any machine you wish to access you can add a line to the HOSTS file (this is usually /etc/hosts under Linux, somewhere else under Windows and other OS) which itself has a mapping from a name to the IP.

The downside of the second method is you need to do it on every machine you want to access from and also, should the IP change, you need to change it in every hosts file.

3 Use a Dynamic DNS / No IP Service

There are a number of services (free and paid) that allow you to create and manage DNS records. You can use an account on these to set a hostname to resolve to the IP address of your server.

Anywhere online you would then connect to myhostname.myservice and it would resolve to the IP, which could be an external IP or a local IP as you choose.

  • I think OpenDNS reports a hijack attempt if a domain name points towards a local IP... -.- Mar 15 '13 at 15:07
  • I think dyndns is ok with it though - user will just have to try different services.
    – Dave C
    Mar 15 '13 at 15:08
  • Lol, OpenDNS is a DNS server, not a domain registrar! For domains, I actually prefer .tk, they're top-level, but also free. :) Good for small personal servers and stuff. Mar 15 '13 at 15:16
  • Whoops! Just have to hope you're not using OpenDNS if you point to an internal then.
    – Dave C
    Mar 15 '13 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.