logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache, Windows XP Home, and virtual servers
Author
isavepets



Joined: 03 Jan 2008
Posts: 6
Location: Warren, MI

PostPosted: Tue 08 Jan '08 20:24    Post subject: Apache, Windows XP Home, and virtual servers Reply with quote

I am new to Apache but since XP home doesn't have IIS, I am trying to use apache as my local web server.

I have multiple sites I develop locally on my laptop. I am trying to create a local virtual host so I can user Model-Glue to develop.

I am finding it impossible (for me) to create virtual hosts to be able to both set a web root and test my dev sites.

Based on the following information can anyone send me what code I need to create a virtual server(s) on my laptop and let me know how I can call them locally (localhost):

Actual file directory/root: C:\Program Files\Apache\htdocs\isavepets

Also, since this is dev on my personal laptop, I am not concerned about really any security to access the site.

Could you kinda give me a step by step of what needs to be added or uncommented so I can access the sites. Also how do I call them from a URL.

Thanks for any help!
Back to top
isavepets



Joined: 03 Jan 2008
Posts: 6
Location: Warren, MI

PostPosted: Tue 08 Jan '08 22:43    Post subject: Reply with quote

I found the extra/httpd-vhosts file.

I have this now, but I can't seem to pull it up in a browser. Any way to either change it or to make it pull

<VirtualHost *:80>
ServerAdmin webmaster@isavepets.com
DocumentRoot "/Program Files/apache/htdocs/isavepets"
ServerName isavepets.localhost
ServerAlias isavepets.localhost
ErrorLog "logs/isavepets.localhost-error_log"
</VirtualHost>

I have no idea on what the ServerName and ServerAlias should be, I just tweaked what was already there. How do I call this in a browser if it is correct. I just want to use the localhost for local dev.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Wed 09 Jan '08 4:30    Post subject: Reply with quote

You will want to make some additions to your Windows Hosts file.
c:\windows\system32\drivers\etc\hosts

Since I cannot see your comlpete config, nor do I want you to post it, I just want you to make sure to duplicate you "webroot" folder as you called it as the first virtual host. See docs on Virtual Hosting. After that, you can add as many vhosts as you want.

Also, do not forget to add <Directory> containers for all your vhosts, or you will get a 403 (Access Forbidden) error.
Back to top
isavepets



Joined: 03 Jan 2008
Posts: 6
Location: Warren, MI

PostPosted: Wed 09 Jan '08 14:24    Post subject: Reply with quote

I found my hosts file in C:/Windows/I386. I am not sure what to actually add since it already has 127.0.0.2 LocalHost. I want to add the isavepets directory but it needs to also be off of localhost.

What exactly do you mean when you say "I just want you to make sure to duplicate you "webroot" folder as you called it as the first virtual host."? I am a first time user with apache.

Also, what directory information do I need for basically a site that has not restriction on viewing? Since its all locally on my laptop, I dont really need any security.

Thanks.
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Wed 09 Jan '08 18:32    Post subject: Reply with quote

A couple of things:
    1. - You don't want to change the file in C:\Windows\I386.
    The one you want should be C:\Windows\system32\drivers\etc\hosts
    When you find the correct hosts file, add a line to it like this:
    Code:
    127.0.0.1     isavepets.localhost

    2. - You need to add the NameVirtualHost directive to httpd.conf. This goes outside the <VirtualHost *:80> section.
    Code:
    NameVirtualHost *

    3. - You need to add a <Directory> section so Apache will allow access to the isavepets directory. This goes inside the <VirtualHost *:80> section:
    Code:
    <Directory "/Program Files/apache/htdocs/isavepets">
        Allow from all
    </Directory>

    4. - To see the isavepets site in your browser, use the URL http://isavepets.localhost/index.cfm
Hope this helps.

-tom-
Back to top
isavepets



Joined: 03 Jan 2008
Posts: 6
Location: Warren, MI

PostPosted: Wed 09 Jan '08 18:51    Post subject: Reply with quote

Thats for the info. Still having issues. Unless my computer is weird I can only find the other hosts file in the main Windows directory. I did add the 127.0.0.1 isavepets.localhost to it.

I saw where I was told to uncomment out the httpd-vhosts file inside the main http file.

In the httpd-vhost file I have this:

NameVirtualHost * outside the first <VirtualHost *.80> block

Then I have:

<VirtualHost *:80>
ServerAdmin webmaster@isavepets.com
DocumentRoot "/Program Files/apache/htdocs/isavepets"
ServerName www.isavepets.localhost
ServerAlias isavepets.localhost
ErrorLog "logs/isavepets.localhost-error_log"
<Directory "/Program Files/apache/htdocs/isavepets">
Allow from all
</Directory>
</VirtualHost>

When I try to go to the http://isavepets.localhost, it adds the www. infront and then tells me that the server cannot be found. What am I doing wrong? Thanks
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Wed 09 Jan '08 19:39    Post subject: Reply with quote

re: "... it adds the www. in front and then tells me that the server cannot be found. What am I doing wrong?"

Changing the wrong hosts file. The \I386 directory is usually reserved for re-installing Windows. You don't want to be altering any files in this directory.

If you are using Windows Explorer, you may not see all the files & folders in \Windows.
Use the [Tools] [Folder Options] [View] [Hidden Files and folders] [Show hidden files and folders] checkbox to make sure you can see everything.

Do you have a C:\Windows\system32\drivers\etc directory at all? If you do and it doesn't have any hosts file, try copying the hosts file from the \I386 directory to this directory and then editing the copy.

Also, you said this file already had "127.0.0.2 LocalHost" in it. Is that correct? It should be 127.0.0.1.
After editing it, C:\Windows\system32\drivers\etc\hosts should look like this:
Code:
# Copyright (c) 1993-1999 Microsoft Corp.
...
127.0.0.1       localhost
127.0.0.1       isavepets.localhost


-tom-
Back to top
isavepets



Joined: 03 Jan 2008
Posts: 6
Location: Warren, MI

PostPosted: Wed 09 Jan '08 22:26    Post subject: Reply with quote

I have no windows32 folder at all. I already am showing hidden files and folder and still no windows32 folder. There IS a host file in the main windows folder in which I am making the edits to and not the one in the I386 folder.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Thu 10 Jan '08 2:09    Post subject: Reply with quote

c:\Windows
| - system32
| |-drivers
| | |- etc

not "windows32", SYSTEM32
Back to top
isavepets



Joined: 03 Jan 2008
Posts: 6
Location: Warren, MI

PostPosted: Thu 10 Jan '08 3:07    Post subject: Reply with quote

Odd, did you know that in some windows xp the system32 folder is hidden even when you 'show hidden files'. I found this:

typing:
attrib -a -h -r -s c:\windows\system32
at a command prompt makes it show!!!!

Now maybe I can get somewhere
Back to top


Reply to topic   Topic: Apache, Windows XP Home, and virtual servers View previous topic :: View next topic
Post new topic   Forum Index -> Apache