...

View Full Version : Virtual Directory in Apache 2 / Windows



Bengal313
06-26-2008, 08:25 PM
I just installed Xampp on my XP machine.

http://www.apachefriends.org/en/xampp.html

Currently the default location for the pages are at:

C:\xampp\htdocs

I have a external Hard drive that I work off, that contains my sites at:

S:\Webs

How can I configure Apache 2 to add S:\Webs as an additional virtual location?

_Aerospace_Eng_
06-26-2008, 08:51 PM
http://www.ardamis.com/2005/08/11/xampp-apache-namevirtualhost/

Bengal313
06-26-2008, 10:10 PM
Great Tutorial!

In this tutorial all the sites are under: drive:/xampp/htdocs

Is it possible to have additional sites located elsewhere, like on an external drive? Reason being, I work off this drive at work and at home.

_Aerospace_Eng_
06-26-2008, 10:59 PM
Just change the location to the location of your files. It helps if you actually TRY it you know.

Bengal313
06-27-2008, 05:55 AM
Just change the location to the location of your files. It helps if you actually TRY it you know.

No need for the extra remark. :o I should have stated that I tried that and was getting an error.

Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.

Error 403


I changed the permissions on the external drive (s:/webs) to share out to everyone and gave "read" access. I am running an XP pro machine. Any thoughts?

_Aerospace_Eng_
06-27-2008, 07:18 AM
If you run your files off of that drive why not install xampp directly to that drive? You can make an install of xampp portable by manually extracting the xampp files to your drive.

http://portableapps.com/apps/development/xampp

Bengal313
06-27-2008, 04:40 PM
Yeah I could do that. But is it possible to fix the error I'm getting from the way I have it set up already? Do the folders on the external drive need special permissions? I currently have then as "Read".

_Aerospace_Eng_
06-27-2008, 08:02 PM
No need to change permissions. Your virtual hosts block needs to look like this though inside of httpd-vhosts.conf

<VirtualHost *:80>
DocumentRoot "S:\Webs"
ServerName webs.local
<Directory "S:\Webs">
Options Indexes FollowSymLinks
AllowOverride FileInfo
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Adjust the ServerName to your liking.

Bengal313
06-27-2008, 08:48 PM
Okay Here is what I did.

First added these entries to the host file:

127.0.0.1 localhost

127.0.0.1 shumonhakim.localhost (site is located at s:\webs\shumonhakim)

127.0.0.1 xampp.localhost (site is located at C:\xampp\htdocs\xampp)

Next, I add this to the httpd-vhosts.conf

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs"
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "S:/Webs/shumonhakim"
ServerName shumonhakim.local
<Directory "S:/Webs/shumonhakim">
Options Indexes FollowSymLinks
AllowOverride FileInfo
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/xampp"
ServerName xampp.localhost
</VirtualHost>


Finally, I restarted

Results: When I type in, http://localhost , http://shumonhakim.localhost

They all go to a index.html page located at c:/xampp/htdocs/xampp/index.html

But http://xampp.localhost goes to the right site.

_Aerospace_Eng_
06-28-2008, 03:52 AM
Don't use .localhost

Also no need to set one for the default xampp directory. Use .local instead. Its what I use and it works fine.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum