Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Regular Coder Bengal313's Avatar
    Join Date
    Jun 2002
    Location
    Metro Detroit
    Posts
    298
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Virtual Directory in Apache 2 / Windows

    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?
    "Knowledge Speaks But Wisdom Listens"

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder Bengal313's Avatar
    Join Date
    Jun 2002
    Location
    Metro Detroit
    Posts
    298
    Thanks
    8
    Thanked 0 Times in 0 Posts
    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.
    "Knowledge Speaks But Wisdom Listens"

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Just change the location to the location of your files. It helps if you actually TRY it you know.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    Regular Coder Bengal313's Avatar
    Join Date
    Jun 2002
    Location
    Metro Detroit
    Posts
    298
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    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. 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?
    "Knowledge Speaks But Wisdom Listens"

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #7
    Regular Coder Bengal313's Avatar
    Join Date
    Jun 2002
    Location
    Metro Detroit
    Posts
    298
    Thanks
    8
    Thanked 0 Times in 0 Posts
    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".
    "Knowledge Speaks But Wisdom Listens"

  • #8
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    No need to change permissions. Your virtual hosts block needs to look like this though inside of httpd-vhosts.conf
    Code:
    <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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • Users who have thanked _Aerospace_Eng_ for this post:

    Bengal313 (06-27-2008)

  • #9
    Regular Coder Bengal313's Avatar
    Join Date
    Jun 2002
    Location
    Metro Detroit
    Posts
    298
    Thanks
    8
    Thanked 0 Times in 0 Posts
    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.
    Last edited by Bengal313; 06-28-2008 at 12:22 AM.
    "Knowledge Speaks But Wisdom Listens"

  • #10
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •