Reputation: 908
I am running xampp on windows 7. When I do http://localhost
, I get the xampp welcome screen in my web browser but http://127.0.0.1
does not work. In my windows hosts file, I have uncommented 127.0.0.1 localhost but the problem still exists. I have checked to see if firewall is blocking anything but still no good results.
How do I resolve this problem.
Upvotes: 8
Views: 42789
Reputation: 97
Here is a simple solution taken from here
Increase the priority of IPv4
Microsoft Windows [Version 10.0.19044.1826]
(c) Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>netsh interface ipv6 show prefixpolicies
Querying active state...
Precedence Label Prefix
---------- ----- --------------------------------
50 0 ::1/128
40 1 ::/0
35 4 ::ffff:0:0/96
30 2 2002::/16
5 5 2001::/32
3 13 fc00::/7
1 11 fec0::/10
1 12 3ffe::/16
1 3 ::/96
C:\WINDOWS\system32>
C:\WINDOWS\system32>netsh interface ipv6 set prefixpolicy ::ffff:0:0/96 55 4
Ok.
C:\WINDOWS\system32>
C:\WINDOWS\system32>netsh interface ipv6 show prefixpolicies
Querying active state...
Precedence Label Prefix
---------- ----- --------------------------------
55 4 ::ffff:0:0/96
50 0 ::1/128
40 1 ::/0
30 2 2002::/16
5 5 2001::/32
3 13 fc00::/7
1 11 fec0::/10
1 12 3ffe::/16
1 3 ::/96
Here is the result:
C:\WINDOWS\system32>ping localhost
Pinging Sumonst21 [127.0.0.1] with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
C:\WINDOWS\system32>
Hope this will help someone coming to this thread by 2022 :)
Upvotes: 2
Reputation: 905
I personally couldn't get 127.0.0.1 working on it's own in the Apache httpd.conf file. So I added a port number at the end. Usually it's just :80.
However, I have Skype running on my machine which causes a conflict so I use port :8080.
Listen 127.0.0.1:8080
Is what I have in the config file and in the browser I enter: http://localhost:8080
This works and keeps it on local only. You can either type in localhost to find your apache server or your local ip address. You can find your local ip address in cmd with an ipconfig command.
Upvotes: 2
Reputation: 428
If localhost working and 127.0.0.1 not working
Try 192.168.1.1 or 192.168.1.(your system number)
It should work..
Upvotes: -3
Reputation: 11035
What I had to do was:
1) Make sure I had all files located inside of C:\inetpub\wwwroot
backed up somewhere, just in case.
2) Go to the windows search
OR control panel
and openTurn Windows features on or off
3) The box next to Internet Information Services
needs to be checked (it will appear as a green square inside of the grey square).
4) Now I can type 127.0.0.1 or http://localhost and get the correct page which should look like this image
5) Profit
.
Upvotes: 2
Reputation: 104514
Two or three shot in the dark guesses. This is how I would diagnose the issue.
It's possible that your web browser is resolving localhost
on your computer to the IPV6 loopback address, ::1
. Compare the results of typing http://[::1]
and compare the results to http://127.0.0.1
and http://localhost
to see if that reveals anything. As to why xampp is working on IPV6, but not IPV4 is another issue.
You might have a web proxy installed on your network and your Internet Options or browser settings is configured to use it. This will bypass DNS and the hosts file and send the request straight to the proxy. And the proxy server probably resolves 127.0.0.1 and localhost differently. This also applies to any sort of local proxy, internet speed-up software, anti-virus scanner, Fiddler, etc... Try going to Control Panel->Internet Options and select the Connections tab. Then select the "LAN settings" button. Make sure all the checkboxes are turned off on this dialog. Run the "Setup" button at the top of the Connections dialog just to be sure. See picture below
Disable the Windows Firewall and/or any other sort of Firewall software you may have. Just so we can rule that out. Any change?
But your BEST option will be to install Wireshark or Netmon and get a trace of http://localhost
connection and compare that to the http://127.0.0.1
address. That should reveal something...
Upvotes: 17