Support Home » VirtualHostX » How To's
With the exception of your websites' files themselves, all of the other configuration files and settings related to VirtualHostX's web server are stored inside the virtual machine - not on your Mac.
If you need to edit one of those files - Apache's main .conf file as an example - you have a two options:
In the following sections I will show how to edit the web server's main configuration file using the two methods above. The file we'll be editing is located inside the virtual machine (not on your Mac) here:
/etc/apache2/apache2.conf
First, launch VirtualHostX and then click the "Terminal" button in the app's toolbar to connect to the virtual machine.
In the Terminal window that appears, type the following command and press return:
nano /etc/apache2/apache2.conf
The nano text editor should open in your Terminal window and show the contents of that file. You can make any neccessary edits and then save your changes. Here is a tutorial for using nano.
Using a 3rd party app like Transmit or ExpanDrive will let you browse the virtual machine's filesystem and edit files using your preferred macOS text editor. Here are instructions for connecting with Transmit:
Create a new connection and enter the following settings:
Protocol: SFTP
Host: 172.17.0.10
Port: 22
User Name: vagrant
Password:
Instead of using a password to connect, we need to use a "private key file".
~/Library/Application Support/com.clickontyler.VirtualHostX/VirtualHostX/.vagrant/machines/default/virtualbox/private_key
You can now click the "Connect" button to log in to the virtual machine and browse your files. I recommend saving your connection settings as a favorite within Transmit to remember your settings for the next time.
If you need to modify a system file, such as your PHP or Apache config files, you'll need to have root access to do so.
If you login via the command line, you can simply prefix all of your shell commands with sudo
to run them as root.
However, if you want to use a text editor or other software on the Mac side of things, you'll need to connect over SFTP as the root user. For security reasons, this is disabled by default. But you can turn on this feature...
sudo cp -r ~/.ssh/ /root/
This will copy your authorized SSH keys into the root user's home folder.root
instead of the vagrant
user that was described earlier in this FAQ.You should now have full access to edit system files when you connect.