No matter what I tried I could not configure the Apache DocumentRoot in Apache on Windows via WAMP to see a folder that had been shared by my MAc OS by way of VM Ware Fusion.
I searched all over the internet and was unable to resolve this until setting up a Windows symlink in addition addition to the shared folder.
How to Configure Apache Virtual Host DocumentRoot for a Shared Folder on Mac OS with VM Ware Fusion
Prerequisits
- Install and configuring WAMP
- Edit the hosts file (c:\windows\system32\drivers\etc\hosts) to point at my-site.dev (your locall dev domain)
- edit the the httpd-vhosts.conf file. Mine was located at: C:\xampp\apache\conf\extra\httpd-vhosts.conf
<VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/" ServerName my-site.dev <Directory "C:/xampp/htdocs/"> Order allow,deny Allow from all Require all granted </Directory> </VirtualHost>
Notice the document root is configured to point at
“C:/xampp/htdocs/some-fake-dir”.
However the directory named is not actually there (sort of). This is where we can use a symlink to help Apache work with the directory shared from your Mac OS via VMWare Fusion.
Windows Apache on Vmware Fusion Needed a little Help to see the shared directory
Refer to the following 2 articles (don’t worry they’re short and to the point) in order to get Windows SymLinks working on your virtual machine:
- Symbolic Links Do Not Work in Folders Shared Between Linux/Mac …
- Editing the .vmx file for your VMware Fusion virtual machine
Create the symlink to help VMWare Fusion see the shared folder
- Right-click on “Command Prompt” (AKA Terminal) and select “Run as Administrator”
- Use the mklink command to create a symlink in Windows on your virtual Machine that points from to the shared folder pointing back to your Mac OS shared directory that you wish to use for the document root.
- NOTE: The shared folder takes the form “Z:\<some-shared-folder>”
prompt$> mklink /D "C:\xampp\htdocs\<some-fake-dir>" "Z:\<some-shared-folder-on-mac-os>" symbolic link created for C:\xampp\htdocs\<some-fake-dir> <<===>> Z:\<some-shared-folder-on-mac-os>
Restart Apache and Test
Once the http-vhosts file has been configured to point at the shared folder, and the ServerName (my-site.dev) has been set to point at the domain you have configured in the hosts file, you should be able to view your site file by navigating to http://my-site.dev in the Windows browser on your virtual machine.