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 111.111.111.111, I could add the following lines to the
bottom of my hosts file
So I used 111.111.111.111
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?
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.ifconfig
to get its public IP.In you second machine, edit
/etc/hosts
file and add the below line with that IP: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 myServerName
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.
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!".
type
in your terminal.
You have to enter your IP address instead of
111.111.111.111
To get the IP address type
in terminal.
There you can see