0

I have an Ubuntu16.04 Host, Virtualbox 5.2.4, Vagrant 2.0.4, and Homestead-7 installed. I managed to successfully configure all of my drupal apps, and imported the db's, and configured the /etc/hosts files. I am ready to edit my websites... except one major (newbie) problem. How do edit files on host, then immediately see the changes reflected on my guest machine hosting my website?

There was a suggestion to move my files/directories into the same folder as my Vagrantfile which I did, however that didn't seem to work. My Homestead.yaml structure is below:

folders:

- map: ~/Homestead/public_html/drupalsitefolder
  to: /public_html/drupalsitefolder
  type: "rsync"
  options:
      rsync__args: ["-v", "-a", "-h", "-r", "-u", "--delete", "-z"]

sites:

- map: drupalsite
  to: /public_html/drupalsite
  type: "apache"
  php: "7.1

However, after I edit & save a css file for example... the changes do NOT get reflected to the website being hosted by the guest. Sorry if this is a noobie question, but I certainly don't want to scp for every minor edit.

Can anyone give me advice on how to jump the last hurdle?

Thanks

B-zaro
  • 205
  • 1
  • 14

1 Answers1

0

For any other Laravel/Homestead newbies that might run into the same problem, I will go ahead and answer my own questions.

1.) Open your Vagrantfile located in your Homestead folder.

2.) before the closing "end" at the bottom of the Vagrantfile insert the this line config.vm.synced_folder "src/", "/srv/website"

"src/" = /home/your_user_name/folder_with_your files

"/srv/website" = /home/vagrant/folder_with_your files (NOTE: This location can be anywhere inside the VM box that you want, placing it in the home folder is just convenient.)

3.) Then use vagrant reload --provision (or vagrant up depending if your box has been created or not).

4.) When that is done use vagrant ssh to enter your VM box and change the document root of apache to /home/vagrant/folder_with_your_files follow these instructions

5.) From here use sudo service apache2 restart to reload apache2 so it can "see" your files.

This browse to your website... If you see your website you are good to start editing your files on your host. If you see a "Forbidden Access" error, you simply need to adjust the permissions.

6.) IF NECESSARY, edit your Vagrantfile to appear as follows:

config.vm.synced_folder "src/", "/srv/website", :owner => "www-data", :group => "www-data"

If this doesn't work.. don't good luck fellow newbie! :-)

Community
  • 1
  • 1
B-zaro
  • 205
  • 1
  • 14