3

I am having trouble with a web application; it works fine in the Visual Web Developer IDE, and not at all on the server. My plan is to run the application from the web browser without the IDE being involved by dropping it into the localhost directory and running it from the browser.

But I can't find where this directory is. Does anyone know how to find out?

3
  • I'm assuming you want to find the local folder that is served through your HTTP server when you put localhost into your browser? If so, what HTTP server are you using? Sep 14, 2012 at 14:40
  • @OliverSalzburg, yes, that is correct, and I have no idea. Whatever comes as standard with Windows-XP, I would suspect. Sep 14, 2012 at 14:45
  • I'm assuming Visual Web Developer has an HTTP server built in. So when you're running your application, it runs inside of Visual Web Developer. Windows XP does not come with an HTTP server installed by default. You can run netstat -bn on the command line to see which process is listening on which port on your local machine. Maybe that'll allow you to dig deeper :) Sep 14, 2012 at 15:09

2 Answers 2

3

There is no such thing as a localhost directory by default. You first have to install a web server, and then drop your files in the directory that is specified in the configuration. The default for Apache is C:\Program Files\Apache Software Foundation\htdocs, for instance, but it completely depends on your configuration.

5

This isn't a very helpful answer. Why do experienced people do this? Just lack of communication skills or what?

The file you need to find is called (in a Windows OS) httpd.conf. It should be found somewhere under where you (or someone) installed Apache. In my W10 system it is located at D:\apps\Apache24\conf\httpd.conf. If you are delving into Mac or Linux you'll probably be quite a techy person already and be able to find out where your Apache server is installed.

In that .conf file you need to find a crucial line where the DocumentRoot is set. The location in my httpd.conf file looks like this:

# DocumentRoot "${SRVROOT}/htdocs"
# <Directory "${SRVROOT}/htdocs">
DocumentRoot "X:/htdocs/html"
<Directory "X:/htdocs/html">

... that's because I changed the default location at some point. Hash (#) at the beginning of a line means: comment this line out.

Now my "localhost" home is at X:\htdocs\html\ (where html is a directory). If I put an index.html file there and then go "http://localhost" in my browser it displays the html contents of index.html.

3
  • "This isn't a very helpful answer" - it appears the OP disagreed. Do you expect people to know everything before they answer? I've had quite a few questions, with more detail and more tags, that are even now unanswered, and I would MUCH prefer an incomplete answer to none at all. Besides, are you sure the other answer was from someone who was experienced at the time? The other answer was 7 years ago. Upvoting this anyway, because it WAS more helpful. Dec 12, 2019 at 16:19
  • The OP chose m457r's answer in 2012. I answered in April 2019. It's possible that m457r may not have been experienced, but it sounded like she was knowledgeable: specifically "it completely depends on your configuration" is like saying: "I know how to answer your question but I can't be bothered". Most newbs (I was one once!) who struggle to get an Apache server running on their machine are going to encounter httpd.conf soon enough. All it needed was to mention this file. Thanks for the upvote :-) Dec 12, 2019 at 21:34
  • Hmm, I just thought they were referring to the exact folder location, there, like C:\Program Files\Apache24\ vs E:\programs\Apache24\, etc. Dec 12, 2019 at 23:31

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.