Luca Reghellin
Luca Reghellin

Reputation: 8113

Where does Homestead/Vagrant put folders?

I'm new to app development, new to Laravel and new to Homestead. I've just successfully served up my first 'hello world' home page via Vagrant/Homestead.

I have a few of questions:

  1. Assuming my config is the following:

    folders:
        - map: ~/Documents/projects/tests
          to: /home/vagrant/tests
    
    sites:
        - map: test1.local
          to: /home/vagrant/tests/laravel1/HTML/public
    

    Where the is the /home/vagrant/tests folder physically located? Or, where can I find this kind of info (apart from here)?

  2. I started the server with vagrant up. Ok. I see no logs on the Terminal. I was used to have logs during requests. So will the server run forever and ever? Or how to eventually shut it down?

  3. How to see logs?

Upvotes: 1

Views: 2301

Answers (3)

Tpojka
Tpojka

Reputation: 7111

  1. As mapped so in ~/Documents/projects/tests on host OS and ~/tests/laravel1/HTML in guest OS
  2. vagrant halt (from same directory where you issued vagrant up)
  3. Logs on Ubuntu are in /var/log/apache2/access.log and /var/log/apache2/error.log by default. Application (PHP error within) you can see in (in your case) /home/vagrant/tests/laravel1/HTML/storage/logs/laravel.log

Not asked how but

  1. You access your guest server virtual machine with vagrant ssh command

Upvotes: 1

Kirk Beard
Kirk Beard

Reputation: 9843

Where the hell is /home/vagrant/tests folder physically located? Or, where can I find this kind of info (apart from here)?

The /home/vagrant folder is stored in the virtual hard disk of the virtual machine. You cannot access it from your host OS.

On my computer, it's located in ~/.vagrant.d/boxes/laravel-VAGRANTSLASH-homestead/5.1.0/virtualbox/ubuntu-16.04-amd64-disk001.vmdk. It may differ on your machine.

It doesn't matter where that directory is though, because the real files are stored in the ~/Documents/Projects/tests directory which is mapped to the virtual hard disk. Any changes that you need to make to these files, you should be making in that directory.

I started the server with vagrant up. Ok. I see no logs on the Terminal. I was used to have logs during requests. So will the server run forever and ever? Or how to eventually shut it down?

The machine will run until it's stopped, using vagrant halt or you shut down your machine.

How to see logs?

Laravel stores your logs in storage/logs within the Laravel directory. Based on your configuration, you should have log files in the ~/Documents/projects/tests/Laravel1/HTML/storage/logs directory.

Upvotes: 1

Zoe Edwards
Zoe Edwards

Reputation: 13697

  1. It’s on your VM, so it’s inside the VM’s directroy. Depending on what VM you’re using, it’ll be in there.

  2. The oposite of vagrant up is vagrant halt

Upvotes: 1

Related Questions