1
1
If I try to access localhost
or 127.0.0.1
or even my local IP address 192.168.1.14
the browser is unable to resolve this!? (Why it's even trying to resolve it I don't know - I didn't think it would need to?)
The browser is taking time to try and resolve this and eventually fails by attempting http://www.localhost/
(in the case of localhost
).
Tried all browsers... Chrome, Firefox, Opera, Safari.
This was working OK! I have just installed XAMPP (Apache, MySQL, PHP, ...) and after installing I could navigate to localhost
to see the default XAMPP welcome page.
localhost
stopped working first, whilst I could still navigate to 127.0.0.1
. But now neither of these work (as if it took time for caches to clear?!). And neither does 192.168.1.14
(my local IP).
Bizarrely I can still navigate to localhost/index.html
, localhost/xampp
, localhost/phpmyadmin
, etc. But not the bare localhost
. (Although I'm convinced I lost access to all bar localhost/phpmyadmin
at one point!?). In the same way I can access http://192.168.1.14/index.php
and 192.168.1.14/xampp/
, but not 192.168.1.14
.
The webserver appears to be working OK. I can navigate to a local site I have setup in a VirtualHost and that works OK (just PHP, no DB).
'ipconfig /flushdns
- reports that it was successfull, but no change.
Turning off the webserver makes no difference. (Without the webserver running it should immediately fail, but instead it still tries to resolve it.)
Turned off Anti-Virus and Windows Firewall - no difference.
Windows HOSTS file previously did not have an entry for localhost
(even when it worked OK). I have added an entry for localhost
, but this makes no difference. Like I mentioned above, even using 127.0.0.1
directly does not work! The IPv6 (::1
) entry is commented out.
127.0.0.1 localhost
ping localhost
works! And appears to correctly ping my local computer (the computer name is reported). So, why does this work, and nothing else?
I can create a VirtualHost with ServerName mylocalhost
and add an approprite entry in my Windows HOSTS file to point to 127.0.0.1
ie. 127.0.0.1 mylocalhost
and this works OK! (This displays the "Welcome to XAMPP..." homepage)
The default document (ie. DirectoryIndex
) is setup OK.
This other question (from 3 years ago!) appears to have the same problem, but no good answers:
Cannot find local host via browser - can ping localhost and 127.0.0.1 ok
In fact I have found numerous other references to localhost
not working, but no answers. Some of these appear to be related to IPv6 conflicts, but I don't think that is the case here.
What error message do you get when attempting to browse to localhost? Do you have any files served on localhost? Maybe tried localhost/index.html ? – Darius – 2014-02-07T10:44:54.220
@Darius: Nothing meaningful is reported by the browser, simply "This webpage is not available" (in Opera, and similar messages in other browsers). Yes,
localhost
should be serving files (the default XAMPP welcome message - which I did see fromlocalhost
when it was first installed). Bizarrelylocalhost/index.html
does work (this is just an "It Works" message) and nowlocalhost/xampp
has started working again, as well as anylocalhost/XXX
URL. But the barelocalhost
(or127.0.0.1
) does not. – MrWhite – 2014-02-07T11:05:40.667@Darius: In fact I quickly setup a
mylocalhost
pointing to the same site (see question update) and this works OK.DirectoryIndex
is setup to serve default files. (Butlocalhost
actually results in the browser trying to resolve it!?) – MrWhite – 2014-02-07T11:06:41.140