Laravel Homestead - php

I'm trying to get Laravel Homestead up and running. I believe I did everything as manual says. When I run vagrant up -command I get following error on OS X 10.9:
My Homestead.yaml file is following:
---
authorize: /Users/foo/.ssh/id_rsa.pub
keys:
- /Users/foo/.ssh/id_rsa.pub
folders:
- map: /Users/foo/projects
to: /home/vagrant
sites:
- map: site.dev
to: /home/vagrant/site/public
And this is what I get while executing vagrant up:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'laravel/homestead' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'laravel/homestead'
default: URL: https://vagrantcloud.com/laravel/homestead
==> default: Adding box 'laravel/homestead' (v0.1.6) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/laravel/homestead/version/7/provider/virtualbox.box
==> default: Successfully added box 'laravel/homestead' (v0.1.6) for 'virtualbox'!
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Setting the name of the VM: Homestead_default_1400312360757_29263
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 80 => 8000 (adapter 1)
default: 3306 => 33060 (adapter 1)
default: 5432 => 54320 (adapter 1)
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => /Users/foo/Homestead
default: /home/vagrant => /Users/foo/Projects
==> default: Running provisioner: shell...
default: Running: inline script
==> default: tee:
==> default: /home/vagrant/.ssh/authorized_keys
==> default: : No such file or directory
==> default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDkJjDXl7bdRlSQ453fsdOE7JZxk5x7b5XxeiQxS2Xitj1DiHTiVbNns71AflaNy+K2ev4SeazibpRrZnZ99Pnvd8XuJwScUZZzGaU/AsbQGDUNuQU4Wa047XhG28uHlfZNM/X3kMmsC73QtyByUDFadTAz2SjhwCBkatmpu8aSwOAtkNDTg+0QLql6yfIHaV5tn8DLBRhWWovpBcrU8aopG+7jgVpHghaIDq/1SmgclOt9paLZV333s9b8f/qCm4zc6sRFCvdKrIYgSutYnPTRkLRXm8ooX8/R6kvpxD6D6ss5e0+rDWgdxCthC2/pqWaZ/B76Pa7FXZlt9lDx7zAR foo#bar.com
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDkJjDXl7bdRlSQ453fsdOE7JZxk5x7b5XxeiQxS2Xitj1DiHTiVbNns71AflaNy+K2ev4SeazibpRrZnZ99Pnvd8XuJwScUZZzGaU/AsbQGDUNuQU4Wa047XhG28uHlfZNM/X3kMmsC73QtyByUDFadTAz2SjhwCBkatmpu8aSwOAtkNDTg+0QLql6yfIHaV5tn8DLBRhWWovpBcrU8aopG+7jgVpHghaIDq/1SmgclOt9paLZV333s9b8f/qCm4zc6sRFCvdKrIYgSutYnPTRkLRXm8ooX8/R6kvpxD6D6ss5e0+rDWgdxCthC2/pqWaZ/B76Pa7F5ZlX9lDx7zAR foo#bar.com
"
Stdout from the command:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDkJjDXl7bdRlSQ453fsdOE7JZxk5x7b5XxeiQxS2Xitj1DiHTiVbNns71AflaNy+K2ev4SeazibpRrZnZ99Pnvd8XuJwScUZZzGaU/AsbQGDUNuQU4Wa047XhG28uHlfZNM/X3kMmsC73QtyByUDFadTAz2SjhwCBkatmpu8aSwOAtkNDTg+0QLql6yfIHaV5tn8DLBRhWWovpBcrU8aopG+7jgVpHghaIDq/1SmgclOt9paLZV333s9b8f/qCm4zc6sRFCvdKrIYgSutYnXTRkLRXm8oor8/R6kvpxD6D6sX5e0+rDWgdxCthC2/pqWaZ/B76Pa7F5Zlt9lDxXzAR foo#bar.com
Stderr from the command:
tee: /home/vagrant/.ssh/authorized_keys: No such file or directory

Map your projects directory to something else than /home/vagrant:
folders:
- map: /Users/foo/projects
to: /home/vagrant/projects
This should fix your problem and you probably don't want your vagrant's config files (.ssh, .bashrc, etc) synced back to your local projects directory anyway.
Also your keys property should be set to private key, not public.

If you look at original Homestead.yaml again, you'll see that:
authorize needs your public key (id_rsa.pub)
keys needs your privte key (id_rsa)

keys should be:
keys: - /Users/foo/.ssh/id_rsa
not
keys: - /Users/foo/.ssh/id_rsa.pub

Homestead is just an implementation of vagrant.
Try:
homestead up
If this still doesn't work, try
homestead destroy && homestead up

A little suggestion here based on my own learning experience. Homestead provides a nice and neat way for beginners to work on Laravel Framework in no time. However, I think the vagrant settings and weird environment is not straight forward to me.
I believe everyone has to work with the real Server and Laravel environment eventually. Therefore, I decided to give up homestead and simply install Ubuntu on VirtualBox. Then, I followed official instructions here and installed my Laravel pretty easily.
Just for your information. Just go straight to the real Laravel system instead of Homestead.

Related

Laravel Homestead errors

I'm getting the following errors when I start up Laravel's Homestead. I've never had issues running it before. Today, I had to upgrade Vagrant and Virtual Box. Below is the complete output, but I'll highlight the errors:
Bobs-MacBook-Air:Applications bob$ homestead up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Setting the name of the VM: homestead
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 80 (guest) => 8000 (host) (adapter 1)
default: 443 (guest) => 44300 (host) (adapter 1)
default: 3306 (guest) => 33060 (host) (adapter 1)
default: 5432 (guest) => 54320 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => /Users/bob/.composer/vendor/laravel/homestead
default: /home/vagrant/Code => /Users/bob/Code
==> default: Running provisioner: file...
==> default: Running provisioner: shell...
default: Running: inline script
==> default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDB38DDrXR6I0zGeWaKFD3FPkDSVuWIOz799ZtEH3jI8cqAvi3yDcFHLD1hCEyJbdoB5nrXI7TqkuGNdHpqo3auliwUshlg1kHahW4//hsWufv4W33vUDeh8UwOpAWKYc6JrSR5+/LCFomwdr2E7kq1wQKG0O4bcvXyZ/gn+umAf9YYiLA7XJViZUc7OOyNhNVRIXSL6NpH9hhsv9NHmB6Xe+hGiB2ctGD00xeh9GxEvORtMQhwjiVN9BiOaAJAM+kH23hS8j5mkxQBgVGANTa5IREVeEOfI+zsT73HFuEU7I8sXZrdl6XJwmdW8zUkzvMrxwucdTDYQkcAcYP/MsXJ bob#Bobs-MacBook-Air.local
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: shell...
default: Running: /var/folders/cr/44dtbc853jq9lyc2mwhg87m80000gn/T/vagrant-shell20170119-5395-doo0yi.sh
==> default: Failed to restart php5-fpm.service: Unit php5-fpm.service not found.
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
==> default: Failed to restart php5-fpm.service: Unit php5-fpm.service not found.
How can I fix these errors so Homestead runs like normal? I'm using OSX.

Homestead not setting up the VM web apps

I'm trying to start up Homestead to work on a couple websites located in the virtual machine, but they are not available, even though they were working yesterday when I configured it for the first time, and even though no error is displayed. This is the output text of the homestead up:
C:\Users\Luis>homestead up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 80 => 8000 (adapter 1)
default: 443 => 44300 (adapter 1)
default: 3306 => 33060 (adapter 1)
default: 5432 => 54320 (adapter 1)
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => C:/Users/Luis/AppData/Roaming/Composer/vendor/laravel/homestead
default: /home/vagrant/Code => D:/www
default: /home/vagrant/laravel => D:/www/laravel
default: /home/vagrant/Code/phpmyadmin => D:/www/phpmyadmin
default: /home/vagrant/Code/codeigniter => D:/www/codeigniter
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
As I've mentioned, it was working perfectly yesterday, but I can't access any of the web applications installed (Laravel, phpMyAdmin, Codeigniter).
And this is my homestead.yaml file:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: C:\Users\Luis\.ssh\id_rsa.pub
keys:
- C:\Users\Luis\.ssh\id_rsa
folders:
- map: D:\www
to: /home/vagrant/Code
- map: D:\www\phpmyadmin
to: /home/vagrant/Code/phpmyadmin
- map: D:\www\codeigniter
to: /home/vagrant/Code/codeigniter
- map: D:\www\laravel
to: /home/vagrant/laravel
sites:
- map: homestead.app
to: /home/vagrant/Code/laravel/public
- map: laravel.app
to: /home/vagrant/Code/laravel/public
- map: phpmyadmin.app
to: /home/vagrant/Code/phpmyadmin
- map: codeigniter.app
to: /home/vagrant/Code/codeigniter
databases:
- homestead
- codeigniter
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 93000
# to: 9300
# - send: 7777
# to: 777
# protocol: udp
Ping to 192.168.10.10 doesn't work either. The host machine is Windows as you can guess.
The domains are listed within the hosts file too.
What else could I do?
Try to vagrant provision your VM. Also check your Firewall and Antivirus software, try to disable it for a moment and ping 192.168.10.10 again.

Vagrant Machine stopped working

I was using Homestead and vagrant for Laravel, everything was working fine until this morming when I tried to up the machine and work.
i'm getting this error :
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 80 (guest) => 8000 (host) (adapter 1)
default: 443 (guest) => 44300 (host) (adapter 1)
default: 3306 (guest) => 33060 (host) (adapter 1)
default: 5432 (guest) => 54320 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
Anyone can help me fix this issue without reinstalling all over again?
What I have tried :
Restarting my computer
Closing some application
Deleting the VM
Shutting off my Firewall
VagrantFile content
it look like your vagrant has problem accessing your VM using the private-key:
after the error-message, try to enter vagrant using the command vagrant ssh
--> if everything work well without having to enter password then the error is probably somewhere else (see the recommended setting using config.vm.boot_timeout)
maybe your private-key is not in the known_hosts list of you VM
2.1 back-up the private key in your workstation
a) As default, when using UBUNTU-OS, the file is located at ~/.vagrant.d/insecure_private_key
b) You can also run the command vagrant ssh-config after vagrant up, in order to retrieve the exact location of the private_key in use)
2.2 delete the file and restart vagrant
vagrant reload or vagrant reload --provision
vagrant will try to regenerate a new private key for you.
Edited
According to the vagrantfile you have added:
You should also configure the network similar to the following example (remove the # and check if the content of your vagrantfile look like the example bellow):
MY_IP_ADDRESS = '10.11.12.15'
Vagrant.configure(2) do |config|
config.vm.box = "base"
config.vm.network :private_network, ip: MY_IP_ADDRESS
config.ssh.forward_agent = true
end
You should check the box you are using, maybe the box does not exists
example "hashicorp/precise64"
please check the vagrant-documentation # https://www.vagrantup.com/docs/boxes.html

Vagrant up error, changing ownership of /vagrant: not a directory

I'm running Windows 8.1 64-bit on a laptop.
I've been following this guide to try an setup a homestead for my Laravel projects: laravel installation and setup
guide tldr: You just install vagrant, virtual-box and composer. You use these to acquire homestead, then initialize and install. You configure your homestead.yaml and generate ssh keys. After all this you use vagrant up, to have vagrant setup your Vritual machine with your development enviroment and all that stuff.
Using git bash, I follow the guide and get to the 'vagrant up' part.
Here is where it gets hairy, I get the following error:
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Setting the name of the VM: homestead
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 80 => 8000 (adapter 1)
default: 443 => 44300 (adapter 1)
default: 3306 => 33060 (adapter 1)
default: 5432 => 54320 (adapter 1)
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version o
f
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you
see
default: shared folder errors, please make sure the guest additions within t
he
default: virtual machine match the version of VirtualBox you have installed
on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.3.14
default: VirtualBox Version: 5.0
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => C:/Users/Work/Homestead/Homestead
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
chown `id -u vagrant`:`id -g vagrant` /vagrant
Stdout from the command:
Stderr from the command:
chown: changing ownership of ���/vagrant���: Not a directory
I have run git bash as admin.
my .yaml file looks like this
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: C:/Users/Work/.ssh/id_rsa.pub
keys:
- C:/Users/Work/.ssh/id_rsa
folders:
- map: C:/Users/Work/Projects
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
I got the newest version of Vagrant and Virtual Box.
It seems to me like the error comes from the path to the folder being invalid, but seeing as my yaml file should be correct I don't understand how to solve it.
I did successfully install homestead environment on another windows 8.1 stationary PC but I never encountered this error.
Mitchell confirmed for us that this was a bug in the latest version, it's fixed by now: look at this issue and the relevant commit https://github.com/mitchellh/vagrant/issues/5933
I've just made it through.
So you have Vagrant and the latest VirtualBox.
Restart your computer now if you didn't do it after any of the installations
Uninstall Vbox 5.0
Restart the computer again
Download and install 4.3.30 for amd/x86
Run vagrant up and there you are
So, here is how I actually managed to fix it.
The newest versions of Vagrant (1.3.5) and VirtualBox (4.3.4) do not play together at all on Windows. So, I kept Vagrant 1.3.5 and went down to VirtualBox 4.2.2.
Once you have that, you have to get rid of a couple folders so that everything resets itself correctly:
Users\<<USERNAME>>\.VirtualBox
Users\<<USERNAME>>\.vagrant.d
Delete those before trying to run
vagrant up
With that, I was able to get everything running again. However, I have noticed that running vagrant up does go a tad slower than it had been previously. I can live with that though.
Thank you for all of your help and suggestions.
Currently Vagrant (<=1.7.3) has a bug with VirtualBox 5.0. According to
https://github.com/mitchellh/vagrant/issues/5933
Vagrant 1.7.4 will have a fix for VB 5.0. It can be applied in-tree though, as I mention on the Github issue.
If you get this message then, try to match VirtualBox version on host machine, that will solve the problem.
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.3.10
default: VirtualBox Version: 5.0
not 100% sure but what it seems like, vagrant is trying to map it's default "/vagrant" folder to your local C:/Users/Work/Homestead/Homestead. If the local does not exist or has some permission errors, /vagrant will not be created and the next command on it will fail. Have a look if C:/Users/Work/Homestead/Homestead is created. And also I do not see this mapping in your yaml. /vagrant => C:/Users/Work/Homestead/Homestead. Is your config not being overwritten with something?

Laravel homestead IP address not working

I’m using Laravel Homestead 2.0 for my VM and am trying to serve my sites on the default IP address in the YAML file 192.168.10.10
My /etc/hosts file looks like this:
# Homestead
192.168.10.10 beta.dev
192.168.10.10 deploy.dev
My Homestead.yaml file looks like this:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Projects
to: /home/vagrant/Projects
sites:
- map: beta.dev
to: /home/vagrant/Projects/emorybeta/public
- map: deploy.dev
to: /home/vagrant/Projects/deploy/public
...
The sites come up when I link my domains to 127.0.0.1 but I have to append port 8000 onto the end of the URL (which isn’t a big deal, I just want to get the specified IP address to work).
Does anyone know why I cannot connect to server when my domains are pointed to 192.168.10.10?
UPDATE:
When I ping deploy.dev the right IP address shows up, but still my browser can’t connect to the server. I’m thinking it might have something to do with DNS issues in Yosemite.
I had the same problems a few weeks ago.
First:
make sure your folder paths are correct, if so, double check it
Next:
run homestead destroy and homestead up to reinitialize the VM
if that all didnt work:
Check if you have any devices at home that might also be on 192.168.10.10.
If that all didnt work, your problem is probably alot harder to fix and i'd suggest making a github issue for it.
Hey I had this exact same problem. I eventually got it working by installing the deprecated net-tools package:
sudo apt-get update and
sudo apt-get install gnome-nettool
After this,
homestead destroy and
homestead up
This allowed me to access my virtual machine sites from my local machine's browser using the 'domains' I specified in the hosts file - in your case beta.dev and deploy.dev - without referring to localhost or port 8000. Good luck, hope this helps.
This is the solution I did for my Windows 10 machine:
Make sure you add a persistent route to your vagrant box
In Administrator command prompt enter
route -p add 192.168.10.0 mask 255.255.255.0 192.168.10.1
And make sure you are able to ping 192.168.10.10
Also check the IP address configured for the virtualbox host-only adapter is 192.168.10.1 with mask 255.255.255.0
I had a similar issue yesterday for Homestead 5. It turned out the cause of my problem was that I was running the wrong Vagrantfile.
An instance should give a response to the ip address: 192.168.10.10
To correct the problem in my case what I did was to follow these instructions: http://laravel.com/docs/5.0/homestead
To recap:
In terminal run:
vagrant box add laravel/homestead
then
git clone https://github.com/laravel/homestead.git Homestead
then
cd ./Homestead
and run this command FROM INSIDE the new "Homestead" folder
bash init.sh
then run the commands vagrant up and vagrant provision to that Vagrantfile, that should have been created inside ./Homestead
Here is what the output of the vagrant provision command looks like on my system:
vagrant provision
==> default: Running provisioner: file...
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: shell...
default: Running: /var/folders/q6/pgygb1ln4rg7_nvv0p8n1v300000gn/T/vagrant-shell20150714-94163-17xwlzk.sh
==> default: Running provisioner: shell...
default: Running: /var/folders/q6/pgygb1ln4rg7_nvv0p8n1v300000gn/T/vagrant-shell20150714-94163-rncs6l.sh
==> default: nginx stop/waiting
==> default: nginx start/running, process 1751
==> default: php5-fpm stop/waiting
==> default: php5-fpm start/running, process 1766
==> default: Running provisioner: shell...
default: Running: /var/folders/q6/pgygb1ln4rg7_nvv0p8n1v300000gn/T/vagrant-shell20150714-94163-e9qxwn.sh
==> default: Warning: Using a password on the command line interface can be insecure.
==> default: Warning: Using a password on the command line interface can be insecure.
==> default: Running provisioner: shell...
default: Running: /var/folders/q6/pgygb1ln4rg7_nvv0p8n1v300000gn/T/vagrant-shell20150714-94163-14rlz2c.sh
==> default: Running provisioner: shell...
default: Running: /var/folders/q6/pgygb1ln4rg7_nvv0p8n1v300000gn/T/vagrant-shell20150714-94163-16ethaq.sh
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: shell...
default: Running: inline script
==> default: php5-fpm stop/waiting
==> default: php5-fpm start/running, process 1861
==> default: Running provisioner: shell...
default: Running: inline script
==> default: You are already using composer version 92faf1c7a83a73794fb914a990be435e1df373ca.
==> default: Running provisioner: shell...
default: Running: /var/folders/q6/pgygb1ln4rg7_nvv0p8n1v300000gn/T/vagrant-shell20150714-94163-btuuhg.sh
Installing net-tools on ubuntu fixed this for me
$ sudo install net-tools
$ vagrant destroy
$ vagrant up
I had exactly this issue, and it turned out that nginx was failing to start due to an error when loading the TLS certificates. The vagrant up command doesn't report that nginx failed to start, or that any ports failed to bind.
To diagnose this, I did the following:
$ nmap homestead.app
Starting Nmap 7.01 ( https://nmap.org ) at 2017-10-03 16:16 NZDT
Nmap scan report for homestead.app (192.168.10.10)
Host is up (0.00077s latency).
Not shown: 995 closed ports
PORT STATE SERVICE
22/tcp open ssh
1025/tcp open NFS-or-IIS
3306/tcp open mysql
5432/tcp open postgresql
There is no port 80 in the list. Let's double-check port 80.
$ nmap homestead.app -p 80
...
Host is up (0.00020s latency).
PORT STATE SERVICE
80/tcp closed http
So it is certainly closed. What do the guest logs say? vagrant ssh and...
$ systemctl status nginx.service
...
Active: failed (Result: exit-code) since Tue 2017-10-03 03:06:12 UTC; 1min 30s ago
...
homestead systemd[1]: Starting A high performance web server and a reverse proxy server...
homestead nginx[1250]: nginx: [emerg] PEM_read_bio_X509_AUX("/etc/nginx/ssl/homestead.app.crt") failed (SSL: error:0906D06C:PEM routines:PEM_read_bio:no start line:Expecting: TRUSTED CERTIFICA
homestead nginx[1250]: nginx: configuration file /etc/nginx/nginx.conf test failed
homestead systemd[1]: nginx.service: Control process exited, code=exited status=1
homestead systemd[1]: Failed to start A high performance web server and a reverse proxy server.
homestead systemd[1]: nginx.service: Unit entered failed state.
homestead systemd[1]: nginx.service: Failed with result 'exit-code'.
Nginx has failed to start due to an error in it's config. The PEM_read_bio_X509_AUX error points to the /etc/nginx/ssl/homestead.app.crt file. Where is that file used in the configuration?
$ sudo vim /etc/nginx/sites-enabled/homestead.app
I commented out the related lines:
## -1,6 +1,6 ##
server {
listen 80;
- listen 443 ssl http2;
+# listen 443 ssl http2;
server_name homestead.app;
root "/home/vagrant/Code/public";
## -42,7 +42,7 ## server {
deny all;
}
- ssl_certificate /etc/nginx/ssl/homestead.app.crt;
- ssl_certificate_key /etc/nginx/ssl/homestead.app.key;
+# ssl_certificate /etc/nginx/ssl/homestead.app.crt;
+# ssl_certificate_key /etc/nginx/ssl/homestead.app.key;
}
Start nginx with $ sudo service start nginx and run nmap again from the host.
$ nmap homestead.app -p 80,443
...
PORT STATE SERVICE
80/tcp open http
443/tcp closed https
Port 80 is open and should be accessible now from http://homestead.app . Of course TLS won't be working but you should be able to fix it by generating new certificates. I'm not sure of the reason for the certificates failing to load in the first place.
I had the same situation, but I made a change.
I changed my /etc/hosts file with this IP 127.0.0.1
In my case the problem was solved by letting vagrant up install the guest additions:
~/Homestead (master|✔) $ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
[...]
GuestAdditions versions on your host (5.0.26) and guest (5.0.20) do not match.
[...]
Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
mount: /dev/loop0 is write-protected, mounting read-only
Installing Virtualbox Guest Additions 5.0.26 - guest version is 5.0.20
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0.26 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 5.0.20 of VirtualBox Guest Additions...
Removing existing VirtualBox DKMS kernel modules ...done.
Removing existing VirtualBox non-DKMS kernel modules ...done.
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox DKMS kernel modules ...done.
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules ...done.
Doing non-kernel setup of the Guest Additions ...done.
You should restart your guest to make sure the new modules are actually used
After this point, I got a new interface with the expected IP address:
enp0s8 Link encap:Ethernet HWaddr 08:00:27:e8:04:04
inet addr:192.168.8.10 Bcast:192.168.8.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fee8:404/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:996 (996.0 B)
I had this issue come up on my Windows machine and it turns out I had accidentally reversed the folders section "map" and "to". When I found that the folder wasn't underneath ~/code/ in the vagrant ssh session it was obvious it wasn't working right, but double checking the paths didn't yield anything.
Here is the correct way to map the folder section on your Windows machine:
folders:
- map: D:/Development/PHP/projects/
to: /home/vagrant/code
The only reason is need to put hostname and IP in host file
C:\Windows\System32\drivers\etc
Open Notepad as a Admin
click open file and select "host" file
put your domain (eg 192.168.10.10 homestead.app)
save (make sure you are saving as Admin)
Done!
Use this Vagrant plugin
vagrant plugin install vagrant-hostmanager
then run this in your homestead folder to provision again
vagrant reload --provision
Then you do no need to update the host file every time you add a new project!

Categories