http://localhost/ not working on Windows 7. What's the problem?

320,004

Solution 1

To fix the port 80 problem do:

From cmd as administrator:

  1. sc config http start= demand (you need a space after the equal sign and not before)
  2. Reboot
  3. Run the command (netsh http show servicestate) as administrator to check that the port 80 is in use

After you have run this command, you can disable http.sys as follows:

  1. net stop http (stop the process)
  2. Sc config http start= disabled (if you want to disable the service forever)

it works for me.

Solution 2

If you installed it on port 8080, you need to access it on port 8080:

http://localhost:8080 or http://127.0.0.1:8080

Solution 3

It sounds like you have no web server running at all anywhere.

Have you tried enabling IIS and using it to display a basic html file first?

Programs & Features -> Turn Windows Features On/Off -> Internet Information Servcies

Then, place your html file in C:\inetpub\wwwroot\index.html and browse to http://localhost.

Once this works, try to get WAMP/php working. Be careful of port conflicts.

Solution 4

My initial thought is that you are missing an entry in the hosts file. Something like "127.0.0.1 localhost", however, you mention that you are getting a 404 error. That means that the webserver is connecting to your client/browser and responding to the request for a particular webpage.

I'm not familiar enough with Windows 7, however, I'm pretty sure that it does not include a webserver by default. Also, unless you actually code, build and run a webserver application using netbeans you're not going to get the desired response.

When it comes down to it.... your issue is going to be one of the following:

1) you're serving static documents and the webserver is not configured to serve the files from whatever the proper DOCROOT should be. This includes PUBLIC folders in the user's directories. (the basic apache install include a basic homepage)

2) you have a dynamic webserver application where the controller is looking at the application path in order to decide what page to display or what function to execute. (see MVC - Controller). Basically incomplete implementation.

3) yet another configuration error: your website might actually define a virtual domain. (something other than localhost) so when you look for localhost in the URL the server might not be configured to provide a default page.

Solution 5

Uncommenting the following line in host file worked for me,

#127.0.0.1 localhost
Share:
320,004
Alessandro Buscema
Author by

Alessandro Buscema

Updated on July 09, 2022

Comments

  • Alessandro Buscema
    Alessandro Buscema almost 2 years

    I have a big problem opening http://localhost/ on Windows 7 (beta). I installed this os and everything went great; when I installed Wamp I saw that localhost is not working at all. I just see this error:

    Failed to Connect

    Firefox can't establish a connection to the server at localhost.

    in Mozilla and Explorer.

    I removed Wamp and after some weeks (that means two weeks from today) I installed NetBeans on Windows 7. I created a test PHP script and when I debug it, I get the same error again. I tried to access it with ip 127.... but still the same. What is the problem?
    When i installed NetBeans I installed it in port 8080.