I have no experience in about Apache and want to set up Apache Virtual Hosts on Ubuntu 14.04 LTS for a local site on my local machine. I followed this page. But when I try to test http://example.com I got this result in browser:

 Example Domain

 This domain is established to be used for illustrative examples in
 documents. You may use this domain in examples without prior
 coordination or asking for permission.

 More information...

And I expected to get Success! The example.com virtual host is working! as result (as described in followed tutorial).

In that tutorial, I did not understand:

 For the domains that I used in this guide, assuming that my VPS IP
 address is, I could add the following lines to the
 bottom of my hosts file

So I used in /etc/hosts and I guess problem is in about that, but I searched in google and did not find any thing about how to get my VPS IP address to use that. Now how I can get that address or I make mistake and I have to set an address and then use it? In second case how can I do that?

  • You need to change "" to your actual ip address and "example.com" to your actual server name. – Panther Feb 3 '16 at 19:50
  • @bodhi.zazen I think example.com is actual server name. But does changing to actual IP Address cause any problem? – hasanghaforian Feb 3 '16 at 19:54

Step Six — Set Up Local Hosts File (Optional)

If you haven't been using actual domain names that you own to test this procedure and have been using some example domains instead, you can at least test the functionality of this process by temporarily modifying the hosts file on your local computer.

This will intercept any requests for the domains that you configured and point them to your VPS server, just as the DNS system would do if you were using registered domains. This will only work from your computer though, and is simply useful for testing purposes.

Make sure you are operating on your local computer for these steps and not your VPS server. You will need to know the computer's administrative password or otherwise be a member of the administrative group.

If you are on a Mac or Linux computer, edit your local file with administrative privileges by typing:

sudo nano /etc/hosts

He is clearly talking about a second machine not the VPS server. Because if those domains are not yours, you can't have a public DNS to point them to your VPS server. So you can go the other way and trick your second machine using hosts files.

  1. In your VPS server, run ifconfig to get its public IP.
  2. In you second machine, edit /etc/hosts file and add the below line with that IP:

    vps-server-ip example.com
    vps-server-ip test.com
| improve this answer | |

I also had this doubt while following the instructions on this page. I used my internal IP address and the ServerName that I set on the .conf file created and it worked.

In my case before I added this to /etc/hosts the browser displayed "DNS address could not be found." as my ServerName domain didn't existed. In your case, example.com is an real domain. That page with "This domain is established to be used for illustrative..." is the actual page. It is not a message related to something you did while configuring your Apache. You can access this page from any device.

You can find your IP by right-clicking on the network icon and selecting Connection Information. The item IP Address on IPv4 shows you your internal IP address.

| improve this answer | |

I also came across the problem you had. I've done a simple change and I could get the expected result "Success! The example.com virtual host is working!".


sudo nano /etc/hosts" 

in your terminal.

You have to enter your IP address instead of

To get the IP address type


in terminal.

There you can see

inet addr:  in lo section.
| improve this answer | |

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.