Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

OK, this is a bit tricky to explain, but I'll do my best.

I'm running Apache in a VM (Windows XP Mode), and I want to:

  1. Store and edit website files on my main machine (host)
  2. Serve them to the browser within the VM (guest)

Currently, I'm storing, editing and serving everything in the VM, but obviously this is useless for backup, git, etc, so I want to get them out of the virtual machine and into physical directories.

My VM hosts file currently points all domains to to 127.0.0.1:

127.0.0.1    davestewart.local
127.0.0.1    davestewart.remote

My VM Apache httpd-vhosts.conf file looks like this:

NameVirtualHost *:80

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

<VirtualHost *:80>
    ServerName davestewart.local
    ServerAlias www.davestewart.local
    DocumentRoot "c:/xampp/htdocs/davestewart.co.uk"
    <Directory "c:/xampp/htdocs/davestewart.co.uk">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName davestewart.remote
    DocumentRoot "//dave-desktop/work"
    <Directory "//dave-desktop/work">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

The .local version of the site runs just great, and is fully viewable in the VM, but the .remote version outputs a XAMPP 403 Access forbidden! page.

My server skills extend to some .htaccess and .conf editing, usually hacking stuff together from online tutorials, but with no real knowledge of what I'm doing (unlike coding, which I find much easier).

Thanks, Dave

share|improve this question
    
You can set up shared folders, which give the guest access to files on the host. This is normally implemented as a network drive on the guest. blogs.technet.com/b/windows_vpc/archive/2009/12/22/… –  Bob Jun 7 '13 at 10:19
    
Thanks Bob, but I have the folders (drives) shared already, so I don't think this is the issue. –  davestewart Jun 7 '13 at 11:09
    
Oh, I did not see that, sorry. Hmm... Make sure you're running Apache as an account with privileges to access network shares? - by default, it may run as a low privilege user. You could also try mapping the network folder as a local drive letter, either through Windows Explorer or the subst command - that may make it easier to apply local permissions. Perform this mapping as admin if you want it to apply to all users - though I'm not too sure about XP. –  Bob Jun 7 '13 at 11:15
    
Can you also confirm that you can access the network share via Windows Explorer? –  Bob Jun 7 '13 at 11:17
    
The network share is good (i.e. accessing files via explorer), but I'm struggling with the permissions thing (I googled it, but didn't really get it). I just updated WinXP with it's own version of file sharing, which broke everything, so I've reverted, but now Apache won't start as a service, so I'm running it the other way (sorry, not an expert on these matters!). Bit scared about screwing things up, so would be happy to just run on the VM for now, unless this IS easy to sort –  davestewart Jun 7 '13 at 20:47

2 Answers 2

Consider using Vagrant. By default, the VM will have all the files in the root folder available in /vagrant. So, you can configure Apache (on the VM) to serve files in /vagrant/web - and the files served will be those in the web sub-directory of the folder where the Vagrantfile is located. You can find out more in the docs.

share|improve this answer

Why don't you try symbolic links? I know it works in Linux. Just have the files on your host drive. Then make a symbolic link in your VM to the host drive. Voila. Files are on host, but VM "thinks" they are local to it.

We currently use this setup for sort of a backdoor into our files via our office site so we can have access to our job files in the field. But we do not want our job files "in" the web server, but we need the web server to server them to the field via our website. Symbolic links are working great for us.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.