homestead - This webpage is not available - laravel

I do not know where I got stuck, I used already homestead and can not figure out the problem. The virtual machine runs correctly, folders are also mirrored correctly.
$ vagrant reload
==> default: Attempting graceful shutdown of VM...
==> 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/Roko/Homestead
default: /home/vagrant/Code => C:/Users/Roko/Homestead/Code
default: /home/vagrant/Code/geogram => C:/Users/Roko/Homestead/Code/geogram
default: /home/vagrant/Code/phpmyadmin => C:/Users/Roko/Homestead/Code/phpmyadmin
default: /home/vagrant/Code/Laravel/public => C:/Users/Roko/Homestead/Code/Laravel/public
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: to force provisioning. Provisioners marked to run always will still run.
I added entries to the hosts file:
127.0.0.1 phpmyadmin.app
127.0.0.1 homestead.app
and this is YAML file:
ip: "192.168.10.10"
memory: 1048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Homestead/Code
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
- map: phpmyadmin.app
to: /home/vagrant/Code/phpmyadmin/
databases:
- homestead
variables:
- key: APP_ENV
value: local
And I still get This web page is not available for http://homestead.app:8000/
Can someone figure out what am I doing wrong?

Did you tried vagrant reload --provision

Your vagrant up and the Homestead.yaml configruation is fine. But the ip address inside your hosts file should be 192.168.10.10 so to resolve this edit the hosts file acordingly
(read documentation https://laravel.com/docs/5.2/homestead)
192.168.10.10 phpmyadmin.app
192.168.10.10 homestead.app
then reload your vagrant using provision
vagrant reload --provision
That should do it.

use 192.168.10.10 in your /etc/hosts
Example..
192.168.10.10 Laravel.app

Related

Why does vagrant up not generate a code directory?

Currently trying to set up a laravel project I cloned using vagrant on Windows 10. This is my Homestead.yaml file
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.sshhstead/id_rsa.pub
keys:
- ~/.sshhstead/id_rsa
folders:
- map: C:\Users\nikulas\Homestead\code\api
to: /home/vagrant/code
sites:
- map: homestead.test
to: /home/vagrant/code/public
databases:
- homestead
features:
- mysql: false
- mariadb: true
- postgresql: false
- ohmyzsh: false
- webdriver: false
#services:
# - enabled:
# - "postgresql#12-main"
# - disabled:
# - "postgresql#11-main"
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
Inside of my homestead folder I have a code folder that contains my project. Currently it is not being mapped to my vagrant environment and when I ssh into it after running vagrant up and ls I get nothing back.
This is what I get in the terminal when I run vagrant up.
PS C:\Users\nikulas\Homestead> vagrant up
Bringing machine 'homestead' up with 'virtualbox' provider...
==> homestead: Checking if box 'laravel/homestead' version '11.0.0' is up to date...
==> homestead: Clearing any previously set forwarded ports...
==> homestead: Clearing any previously set network interfaces...
==> homestead: Preparing network interfaces based on configuration...
homestead: Adapter 1: nat
homestead: Adapter 2: hostonly
==> homestead: Forwarding ports...
homestead: 80 (guest) => 8000 (host) (adapter 1)
homestead: 443 (guest) => 44300 (host) (adapter 1)
homestead: 3306 (guest) => 33060 (host) (adapter 1)
homestead: 4040 (guest) => 4040 (host) (adapter 1)
homestead: 5432 (guest) => 54320 (host) (adapter 1)
homestead: 8025 (guest) => 8025 (host) (adapter 1)
homestead: 9600 (guest) => 9600 (host) (adapter 1)
homestead: 27017 (guest) => 27017 (host) (adapter 1)
homestead: 22 (guest) => 2222 (host) (adapter 1)
==> homestead: Running 'pre-boot' VM customizations...
==> homestead: Booting VM...
==> homestead: Waiting for machine to boot. This may take a few minutes...
homestead: SSH address: 127.0.0.1:2222
homestead: SSH username: vagrant
homestead: SSH auth method: private key
==> homestead: Machine booted and ready!
==> homestead: Checking for guest additions in VM...
==> homestead: Setting hostname...
==> homestead: Configuring and enabling network interfaces...
==> homestead: Mounting shared folders...
homestead: /vagrant => C:/Users/nikulas/Homestead
==> homestead: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> homestead: flag to force provisioning. Provisioners marked to run always will still run.

Laravel Homestead Vagrant - Cannot see site - installing problems

I have been attempting getting this to work now for 4 hours now and I am struggling.
I am trying to get my homestead working. I followed the installation guide here:
https://laravel.com/docs/5.2/homestead
I have a few questions:
1.) When I install homestead by cloning the github repo - I get a src folder in that installation and in that src folder I have this: src/stubs/Homestead.yaml. When I followed the instructions I ran bash init.sh inside of the root of that installation and that created a /.homestead folder with 3 files in it a after.sh a aliases and a Homestead.yml file. From my understanding I am to modify the Homestead.yml to reflect my enviornment. The question is which one? The one in the hidden .homestead folder or the one in the place where I installed Homestead?
2.) When I go to http://site1.local:8000/ in a browser I get a Site cannot be reached error - refused to connect. When i go to http://localhost:8000/ I get 'No input file specified.'
3.) The command Homestead from the command line isn't recognized as a internal or external command - should it be? I read people with similar problems should run the command homestead up yet it isn't recognized for me.
Here is my Homestead.yml file:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/LaravelProjects/projects
to: /home/vagrant/Code
sites:
- map: site1.local
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
Here is my host file:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
#laravel project 1
192.168.10.10 site1.local
I have updated my hosts file. I have tried running vagrant reload --provision and vagrant destroy and other vagrant commands without luck. Any suggestions?
Here is the dump of running vagrant reload --provision
==> default: Attempting graceful shutdown of VM...
==> 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
default: Warning: Remote connection disconnect. Retrying...
==> 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 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: 5.0.20
default: VirtualBox Version: 5.1
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => C:/Users/Radley.Anaya/LaravelProjects/Homestead
default: /home/vagrant/Code => C:/Users/Radley.Anaya/LaravelProjects/projects
==> 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: C:/Users/RADLEY~1.ANA/AppData/Local/Temp/vagrant-shell20160801-10000-y9i8nr.sh
==> default: Running provisioner: shell...
default: Running: script: Creating Site: site1.local
==> default: Running provisioner: shell...
default: Running: script: Restarting Nginx
==> default: Running provisioner: shell...
default: Running: script: Creating MySQL Database
==> default: Running provisioner: shell...
default: Running: script: Creating Postgres Database
==> default: Running provisioner: shell...
default: Running: script: Clear Variables
==> default: Running provisioner: shell...
default: Running: inline script
==> default: You are already using composer version 1.2.0 (stable channel).
==> default: Running provisioner: shell...
default: Running: C:/Users/RADLEY~1.ANA/AppData/Local/Temp/vagrant-shell20160801-10000-i2qk4o.sh
Update
I ssh'd into the VM and my folder structure looks like: Code/first/index.php how do I update it?
My Homestead.yml file has a different directory structure - I think that is likely causing my issues. How do I fix this?
From my understanding the .yml file dictates the folder structure of the virtual machine? This isn't the case??
Solved
My mappings were messed up. I ssh'd into the vm to verify and updated my .yaml file then provisioned the vm and everything is working. Also I had to remove the port from my url.

Vagrant up error /sbin/ifdown eth1 2> /dev/null

on ubuntu16x64 + virtualbox + vagrant
I'm trying add the laravel/homestead box
I get error in
$ Vagrant up
$ 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-7
==> 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...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
/sbin/ifdown eth1 2> /dev/null
Stdout from the command:
Stderr from the command:
the output refers to a problem with the generated keys
I am not familiar with the key generation, so perhaps the problem is there, I report the steps I did to create them, maybe I made some big stupid
$ cd /home/ubiagio/.ssh/
$ ssh-keygen -t rsa -C biagiopas#yahoo.it
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ubiagio/.ssh/id_rsa): biagiopas_sshrsakey
two keys generated
/home/ubiagio/.ssh/
biagiopas_ssh_key
biagiopas_ssh_key.pub
////////////////////////////////////////////
configuration
~/.homestead/Homestead.yaml
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
#authorize: ~/.ssh/id_rsa.pub
authorize: ~/.ssh/biagiopas_ssh_key.pub
keys:
# - ~/.ssh/id_rsa
- ~/.ssh/biagiopas_sshrsakey
folders:
- map: ~/Code
to: /home/vagrant/Code
sites:
- map: laraveltestblog01.app
to: /var/www/html/laravel/testblog01/public
////////////////////////////////////////////
if the cause is not due to the keys, then may be another problem encountered before
Launching The Vagrant Box
$ cd /home/ubiagio/Homestead/
$ vagrant up
This Vagrant environment has specified that it requires the Vagrant
version to satisfy the following version requirements:
>= 1.8.4
You are running Vagrant 1.8.1, which does not satisfy
these requirements. Please change your Vagrant version or update
the Vagrantfile to allow this Vagrant version. However, be warned
that if the Vagrantfile has specified another version, it probably has
good reason to do so, and changing that may cause the environment to
not function properly.
I tried to upgrade with
$ Sudo apt upgrade
but without success
so I manually changed the Vagrantfile
$ gedit /home/ubiagio/Homestead/Vagrantfile
#Vagrant.require_version '>= 1.8.4'
Vagrant.require_version '>= 1.8.1'
thanks from now for the help

Getting website not found in laravel homestead

I have installed virtual box, vagrant, git bash. everything runs well.
when I command 'vagrant up', no errors shows.
forhad#BlindMirror MINGW64 ~/Homestead (master)
$ vagrant reload --provision
==> default: [vagrant-hostsupdater] Removing hosts
==> default: Attempting graceful shutdown of VM...
==> 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: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> 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: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: [vagrant-hostsupdater] Checking for host entries
==> default: Mounting shared folders...
default: /vagrant => C:/Users/forhad/Homestead
forhad#BlindMirror MINGW64 ~/Homestead (master)
but when I enter website address on browser, it shows http://laravel.dev is not available.
url containing port 2222 works, e.g 127.0.0.1:2222, it shows
SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
on the browser.
no other url works,
Homestead.yaml file:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: C:/Users/forhad/Homestead
to: /home/vagrant/Code
sites:
- map: laravel.dev
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
#ports:
# - send: 93000
# to: 80
# - send: 7777
# to: 777
# protocol: udp

Homestead/Vagrant - no mounted folders

I'm trying to get a Homestead VM setup for my laravel project. I have followed the instructions here exactly. The only difference is the folder I put the Homestead directory in; I simply put it in C:/.
Otherwise I have set up the Vagrant box, cloned and inited Homestead, and set up the homestead.yaml file exactly as instructed. I then start the VM with vagrant ssh. When I use ls to view the folders in the mapped directory - nothing.
This is my homestead.yaml file:
p: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/ssh/id_rsa.pub
keys:
- ~/ssh/id_rsa.pub
folders:
- map: c:/laravelprojects
to: /home/vagrant/Code
sites:
- map: app.dev
to: /home/vagrant/Code/username/public
databases:
- homestead
When I run vagrant up, this is the output:
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-7
==> 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: 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: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => C:/Homestead
As you can see, the last two lines seem to be mounted the wrong folder, ie the folder the Vagrant machine is being started from. However, checking in Virtualbox shows that both this and the folder specified in the .yaml file are set and mapped.
What gives?
/vagrant is mounted by default from the project where Vagrantfile is.
I am not sure if it can be disable from homestead.yaml file directly, but you can edit the Vagrantfile and add
config.vm.synced_folder ".", "/vagrant", disabled: true
so it will not create a /vagrant directory in the VM and VirtualBox will show only your folder specified from the yaml.

Resources