Apache Virtual Host problem in Windows XP
I am working on setting up an apache testing server for personal web development testing. I have the server functioning great at http://127.0.0.1/ but with this I cannot host the many different sites that I am developing and have them live on this local machine.
But I happened across the fact that you can setup Virtual Hosts and Now i'm hooked. I have read every tutorial and searched every forum for this answer and have not found it. If the answer is stupid I apologize.
Here are the specs:
Windows XP pro SP1
apache/2.0.52 (win 32)
I have norton antivirus but no Mcaffee software (which I heard causes problems)
My httpd.conf file has the following configuration
ServerName localhost:80
UseCanonicalNames off
DocumentRoot "c:/www"
NameVirtualHost 127.0.0.1:80
ServerAdmin [email protected]
DocumentRoot "c:/www/"
ServerName localhost
ServerAdmin [email protected]
DocumentRoot "c:/www/pct/"
ServerName pct
ServerAlias *.pct
Options All Includes Indexes
In my hosts file under in system32/drivers/etc/ file I have the following.
127.0.0.1 pct
Here's my problem
When I type in http://pct it will not give me a single page. If I type in http://127.0.0.1/ I get the folder structure showing that PCT is there.
How can I use virtual directories where I can punch in an http address and have that local site come up? I have tried restarting the server several times and rebooted as well. I have also read that this should not be a DNS issue.
Now that I've written a novel I thank you for your time in advance.
kdiff
mairving posted this at 18:33 — 21st October 2004.
They have: 2,256 posts
Joined: Feb 2001
For one, on Windows systems the directory structure goes like this:
DocumentRoot "c:\www\pct\"
I am not sure if the trailing slash is necessary either.
Your log files can also provide some insight into what is going on as well.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
kdiff posted this at 19:07 — 21st October 2004.
They have: 4 posts
Joined: Oct 2004
I will check that out however if you look at the original httpd.conf file it is all forward slashes. I'm not sure why that is. As far as the log files. I did not really see anything.
BRB
-Kdiff
kdiff posted this at 19:22 — 21st October 2004.
They have: 4 posts
Joined: Oct 2004
Checked everything out. It does work to replace the / with \. I checked the log files. If I try to type in http://pct/ it does not show up in the log file. Which makes one think that the server is not even seeing that as a request.
Any ideas?
mairving posted this at 20:19 — 21st October 2004.
They have: 2,256 posts
Joined: Feb 2001
Did you restart Apache when you changed the httpd.conf file?
mairving posted this at 20:22 — 21st October 2004.
They have: 2,256 posts
Joined: Feb 2001
Also try leaving off the trailing \ like this:
DocumentRoot "c:\www\pct"
kdiff posted this at 13:08 — 22nd October 2004.
They have: 4 posts
Joined: Oct 2004
Yes and Yes. I actually totally rebooted my hard drive and I tried the back slashes and now I'm back to the forward slashes. I took them out of the end of the path though. I tried them every way possible. I am back to the forward slashes because of a friend telling me to keep them forward. Not sure if it is right or not.
I have changed my .conf a little since then in trying other things.
Here is a link to my .conf file.
http://diffenderfers.no-ip.com/docs/httpd.conf.txt
Here is what my hosts file says.
127.0.0.1 localhost grahampackco pct
and here is what I get when I type different things into the browser...
If I type in http://pct/ ... I get "the page cannot be displayed"
If I type in http://grahampackco ...I get "the page cannot be displayed"
If I type in http://localhost/... I get the grahampackco home page
Any ideas?
Thanks for all your help so far!
-kdiff
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.