Click On Tyler Support


Contact Us

Support Home » VirtualHostX » Common Questions

How Do Folders and Paths Work Between My Mac and Inside the Virtual Machine?

Last Updated March 26, 2020

VirtualHostX allows you to pick two different folders for your website.

  • Local Path is the top-level folder on your Mac that you want to make available to the web server inside the virtual machine.
  • Web Root is the directory that the web server will actually use to serve your website from (where your HTML files are stored, etc.) and must be _inside_ the Local Path

For most simple websites, you can leave Web Root empty, which will instruct VHX to just use Local Path for both. But for certain web apps like CraftCMS, they require that Web Root be a folder inside the Local Path folder.

Also, the other tricky party is the difference between paths on your Mac and then paths inside the virtual machine.

Paths and folders on your Mac are just like what you expect. You pick the one you want to use with each website in VirtualHostX.

However, the virtual machine that VHX installs on your Mac during the setup process is literally an entirely separate computer running inside (alongside) your Mac. It and your Mac are totally isolated from each other.

VHX does it's magic by making the folders you pick in the app on the Mac side of things available inside the virtual machine. That lets you edit and work with your website files on your Mac using all the same Mac apps you know and love.

But from the perspective of the web server and, most importantly, your PHP files, the paths to your PHP scripts and other assets should be set to how they appear from the perspective of the virtual machine. I know that is confusing; here's a concrete example.

Let's say your website is stored on your Mac here:

/Users/adam/Sites/some-website/

And you've given it a name of "my-website" in VHX.

Inside the virtual machine, your folder and all of your web files will actually be located here:

/var/www/my-website.vhx.cloud/

In fact, all of the websites you create in VHX are in their own folders inside the directory:

/var/www/

with the name blah-blah.vhx.cloud.

So, any PHP scripts you have that manually specify a path need to take that into account. Normally, most PHP scripts are already cool with that. And it helps that VHX uses Apache (the web server) and Ubuntu Linux (the operating system) under the hood - which is likely exactly the same or similar software as what your real web hosting company uses. So most popular web apps will work fine out of the box. This usually only effects customers who had previously built websites specifically to work with Apple's own web server and are now switching to VirtualHostX.

If you're having trouble getting started or find any of the above confusing, feel free to reach out and I'll be happy to walk you through it.