You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Chris Montgomery <ch...@gmail.com> on 2010/06/03 23:21:28 UTC

[users@httpd] Setting Up Virtual Host Help Needed on WinXP

Howdy,

I'm new to Apache web server. I have installed Apache 2.2.15 on my 
Windows development computer to become familiar with using it to run my 
web sites locally. The live production server will run them on a linux 
box under Apache, so I want to get used to working with Apache in my 
development environment.

I have Apache running locally and tested it by hitting http://localhost/ 
in my browser and getting the "It works!" web page. Now I want to simply 
hit an index.html page in the top-level directory that will hold all of 
my sites. On my development box in Windows XP, I have all of my sites 
under d:\webapps\myapps (e.g. d:\webapps\myapps\site1, 
d:\webapps\myapps\site2, etc.). I have put a dummy index.html page under 
d:\webapps\myapps\ and attempted to set up a virtual host pointing to it 
but it isn't working for me.

Here's what I have in my httpd-vhosts.conf file (which is being included 
in the httpd.conf file):

NameVirtualHost *:80

<VirtualHost *:80>
     DocumentRoot "D:/webapps/myapps/"
     ServerName myapps
     ErrorLog "logs/myapps-error.log"
     CustomLog "logs/myapps-access.log" common
</VirtualHost>

Now when I hit http://myapps/index.html in my browser, it redirects to 
http://www.myapps.com/index.html with a page not found error.

Clearly, I'm not understanding how this works. Am I supposed to have an 
entry for myapps in the Windows hosts file (e.g. 127.0.0.1 myapps)?

Any assistance in helping this Apache newbie to get started on this 
would be greatly appreciated. Thanks!

-- 
Best regards,

Chris Montgomery

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Setting Up Virtual Host Help Needed on WinXP

Posted by Chris Montgomery <ch...@gmail.com>.
Nevermind, got it working! Now on to the next roadblock.... :)

Chris Montgomery said the following on 6/3/2010 4:32 PM:
> Thanks for the rapid reply, Jorge. I'll add an entry to my hosts file
> and give it a go. Do I need to reboot windows for that change to take
> effect? Thanks much.

-- 
Best regards,

Chris Montgomery

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Setting Up Virtual Host Help Needed on WinXP

Posted by Chris Montgomery <ch...@gmail.com>.
Thanks for the rapid reply, Jorge. I'll add an entry to my hosts file 
and give it a go. Do I need to reboot windows for that change to take 
effect? Thanks much.

Jorge Schrauwen said the following on 6/3/2010 4:28 PM:
 > Hi,
 >
 > If you add a new virtualhost and give it a hostname (in your case
 > "myapps") you're computer must be able to resolve the name to an IP.
 > Most browser will append .com and prepend www. if they can't find one.
 >
 > So you're assumption of needing to add and entry to your hosts file is
 > correct.
 >
 > Kind regards
 >
 > ~Jorge

-- 
Best regards,

Chris Montgomery

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Setting Up Virtual Host Help Needed on WinXP

Posted by Lester Caine <le...@lsces.co.uk>.
Chris Montgomery wrote:
> Well, not quite there yet. As I said in my other msg, I was able to
> successfully hit http://myapps/index.html and get my dummy page to come
> up after adding "myapps" to my hosts file and adding a Directory entry
> in httpd.conf (I was getting a Access Forbidden before that):
>
> <Directory "D:/webapps/myapps/">
> Order allow,deny
> Allow from all
> </Directory>
>
> Now, when I attempt to reach down into subdirectories, I am encountering
> a 404 Not Found error. For example, I have a test folder under
> D:/webapps/myapps/ but when I point my browser to
> "http://myapps/test/index.html" it throws the 404 error.
>
> There must be some directive in the httpd.conf file to allow sub-folders
> to be visible, right?

Your base httpd.conf file probably has a <Directory /> entry to disable the 
entire file system, but ... AH try taking the final slash off in
     DocumentRoot "D:/webapps/myapps/"
     DocumentRoot "D:/webapps/myapps"

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Setting Up Virtual Host Help Needed on WinXP

Posted by Chris Montgomery <ch...@gmail.com>.
Well, not quite there yet. As I said in my other msg, I was able to 
successfully hit http://myapps/index.html and get my dummy page to come 
up after adding "myapps" to my hosts file and adding a Directory entry 
in httpd.conf (I was getting a Access Forbidden before that):

<Directory "D:/webapps/myapps/">
     Order allow,deny
     Allow from all
</Directory>

Now, when I attempt to reach down into subdirectories, I am encountering 
a 404 Not Found error. For example, I have a test folder under 
D:/webapps/myapps/ but when I point my browser to 
"http://myapps/test/index.html" it throws the 404 error.

There must be some directive in the httpd.conf file to allow sub-folders 
to be visible, right?

Thanks.

Jorge Schrauwen said the following on 6/3/2010 4:28 PM:
> Hi,
>
> If you add a new virtualhost and give it a hostname (in your case
> "myapps") you're computer must be able to resolve the name to an IP.
> Most browser will append .com and prepend www. if they can't find one.
>
> So you're assumption of needing to add and entry to your hosts file is
> correct.

-- 
Best regards,

Chris Montgomery

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Setting Up Virtual Host Help Needed on WinXP

Posted by Jorge Schrauwen <jo...@gmail.com>.
Hi,

If you add a new virtualhost and give it a hostname (in your case "myapps")
you're computer must be able to resolve the name to an IP. Most browser will
append .com and prepend www. if they can't find one.

So you're assumption of needing to add and entry to your hosts file is
correct.

Kind regards

~Jorge


On Thu, Jun 3, 2010 at 11:21 PM, Chris Montgomery <ch...@gmail.com>wrote:

> Howdy,
>
> I'm new to Apache web server. I have installed Apache 2.2.15 on my Windows
> development computer to become familiar with using it to run my web sites
> locally. The live production server will run them on a linux box under
> Apache, so I want to get used to working with Apache in my development
> environment.
>
> I have Apache running locally and tested it by hitting http://localhost/in my browser and getting the "It works!" web page. Now I want to simply hit
> an index.html page in the top-level directory that will hold all of my
> sites. On my development box in Windows XP, I have all of my sites under
> d:\webapps\myapps (e.g. d:\webapps\myapps\site1, d:\webapps\myapps\site2,
> etc.). I have put a dummy index.html page under d:\webapps\myapps\ and
> attempted to set up a virtual host pointing to it but it isn't working for
> me.
>
> Here's what I have in my httpd-vhosts.conf file (which is being included in
> the httpd.conf file):
>
> NameVirtualHost *:80
>
> <VirtualHost *:80>
>    DocumentRoot "D:/webapps/myapps/"
>    ServerName myapps
>    ErrorLog "logs/myapps-error.log"
>    CustomLog "logs/myapps-access.log" common
> </VirtualHost>
>
> Now when I hit http://myapps/index.html in my browser, it redirects to
> http://www.myapps.com/index.html with a page not found error.
>
> Clearly, I'm not understanding how this works. Am I supposed to have an
> entry for myapps in the Windows hosts file (e.g. 127.0.0.1 myapps)?
>
> Any assistance in helping this Apache newbie to get started on this would
> be greatly appreciated. Thanks!
>
> --
> Best regards,
>
> Chris Montgomery
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>