Laravel Homestead - site cant be reached. Windows 10 - php

Im getting started with Laravel Homestead and spend half a day working with tutorials and manuals.
The problem is that everything looks perfect - without any errors, but still I cant see laravel welcom page.
I've installed vagrant and virtual box.
at c:/windows/system32/drivers/etc/hosts added line like:
# 192.168.10.10 homestead.test
My directory tree looks like:
~/Server/.ssh
~/Server/Code
~/Server/Homestead
I made .ssh keys and using git bash:
cd Server
git clone https://github.com/laravel/homestead.git Homestead
cd Homestead
bash init.sh
and configured homestead.yaml file:
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/Server/.ssh/id_rsa.pub
keys:
- ~/Server/.ssh/id_rsa
folders:
- map: ~/Server/Code
to: /home/vagrant/code
sites:
- map: homestead.test
to: /home/vagrant/code/homestead/public
databases:
- homestead
features:
- mariadb: false
- ohmyzsh: false
- webdriver: false
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
Everything looks fine to me so far, is it?
Next in shell:
vagrant up
vagrant ssh
successfully logged to laravel and changed directory to only one existing code, then:
laravel new homestead
Finished iwth message Application ready! Build something amazing.
Did also another one project with different names, but when I type in my chrome browser homestead.test or whatever I call my project -> This site can't be reached.
Thanks for your help.

It sounds like you made the vagrant box first then created a new app after ssh into the vagrant box. I usually take different steps.
Make sure vagrant is installed. https://www.vagrantup.com/downloads.html
Make sure the laravel/homested box has been added to vagrant vagrant box add laravel/homestead
Make sure homestead is installed on the home directory in a file named Homestead git clone https://github.com/laravel/homestead.git ~/Homestead https://laravel.com/docs/7.x/homestead#first-steps
install homestead into your project composer require laravel/homestead --dev
use the make command to generate the vagrant and homestead.yaml files (for windows vendor\\bin\\homestead make) https://laravel.com/docs/7.x/homestead#per-project-installation
Configure the vagrant, homestead.yaml, and hosts file as you have done.
vagrant up

Related

No input files specified - symfony app set up with homestead

I tried to use homestead to iset up Symfony using instruction here. Everything seemed to run correctly in git bash, but after php bin/console server:start, I get "No input files specified" when I go to localhost:8000 or http://127.0.0.1:8000 or symfony-demo.test. I have searched around and tried different approaches for the past 6 hours, but still can't get it work. I'm quite new to virtual machine and vagrant, and complete newbie to Symfony so any help would be highly appreciated!
Here is my Homestead.yaml file:
folders:
- map: C:\php-apps
to: /home/vagrant/code
sites:
# - map: homestead.test
# to: /home/vagrant/code/homestead/public
- map: symfony-demo.test
to: /home/vagrant/code/symfony_demo/web
type: symfony
Here is the host file:
#192.168.10.10 homestead.test
192.168.10.10 symfony-demo.test
Here is latest commands I ran in git bash:
vagrant#homestead:~$ ls
code
vagrant#homestead:~$ cd code/
vagrant#homestead:~/code$ cd symfony_demo/
vagrant#homestead:~/code/symfony_demo$ ls
symfony symfony-demo
vagrant#homestead:~/code/symfony_demo$ cd symfony-demo/
vagrant#homestead:~/code/symfony_demo/symfony-demo$ ls
app bin composer.json composer.lock phpunit.xml.dist README.md src tests var vendor web
vagrant#homestead:~/code/symfony_demo/symfony-demo$ php bin/console server:start
[OK] Server listening on http://127.0.0.1:8000
vagrant#homestead:~/code/symfony_demo/symfony-demo$
I tested Laravel before and it worked fine, though http://127.0.0.1:8000 was also showing laravel after started the symfony server in symfony-demo, so I commented out Laravel site in host file and Homestead.yaml and ran vagrant --provision. Afterwards when I went back to symfony-demo directory and launched the server again, everything starts to show "No input files specified".
I have figured it out so I want to post my solution here just in case someone else ran into the same issues as me. So I'm on a windows 10, before my own config files, please do read careful through these 3 resources:
Using homestead to install Symfony on various version documentation by Symfony
Installing Symfony 3 with vagrant and homestead by Sanket Patel
Set up homestead on windows by JBorbón
Here is what I did:
Create a homestead folder on my C drive.
Install symfony installer on C drive and move it into the homestead
folder above.
Create my project inside of homestead folder above (my project is
called autotrader).
Download vagrant, virtual box and set up homestead according to
their documentation. I set up a directory called
homesteadserver where I cloned homestead in.
Configure my Homestead.yaml file as below:
folders:
# - map: ~/code
# to: /home/vagrant/code
- map: C:\homestead
to: /home/vagrant/homestead
sites:
# - map: homestead.test
# to: /home/vagrant/code/public
- map: autotrader.test
to: /home/vagrant/homestead/autotrader/web
type: symfony
Configure my host file as below:
192.168.10.10 autotrader.test
Go to my homestead server and vagrant up and provision.

Laravel project is not opening in browser using Homestead

I know this question may be overlapping but I have tried most of all answers in online that I could find. But no success so far. So, anyone please help me out.
I am new to both Homestead and Laravel. This is my configuration and details about installation below:
Homestead 7 installed
Vagrant 2.0.3 installed
Composer 1.6.4 installed
Oracle VM VirtualBox 5.2.8 installed
git bash 2.16.1.windows.4 installed
Windows 10 O/S is my Main base O/S
On VirtualBox Manager I got these data=> Name: homestead-7, O/S: Ubuntu (64-bit), Base Memory: 2048 MB, Boot Order: Hard Disk, Optical, Acceleration: VT-x/AMD-V, Nested Paging, PAE/NX, KVM Paravirtualization..... so on
In c:/Laravel_P folder I installed Laravel using Composer in Git Bash:
cd /c/Laravel_P
composer create-project --prefer-dist laravel/laravel wetest
After about command, i got 26.3 MB wetest folder in Laravel_P folder, which was successful installation of Laravel.
Then I backdown from folders to my root by cd command and go to Homestead folder by cd Homestead. After I enter the Homestead folder, I run command:
vagrant up
This runs my Homestead Vagrant successfully (I checked in VB) and when processing this command no any error was shown.
I change my homestead.yaml file to this as my system placements.
authorize: C:/Users/my_user/.ssh/id_rsa.pub
keys:
- C:/Users/my_user/.ssh/id_rsa
folders:
- map: C:/Laravel_P
to: /home/vagrant/code
sites:
- map: homestead.wetest
to: /home/vagrant/code/wetest/public
Also changed my host file and saved the change:
127.0.0.1 localhost
::1 localhost
192.168.10.10 homestead.wetest
Then i run another command:
vagrant provision
I have tried also vagrant reload --provision command also
Now, when i tried to access my Laravel project from
http://homestead.wetest
I got Error:
This site can’t be reached
homestead.wetest’s server IP address could not be found.
In my knowledge, I tried every step as found in web and documentation in Laravel, but why am I not getting the desired result? Please anyone help me in this.
folders:
- map: C:/Laravel_P
to: /home/vagrant/code
sites:
- map: homestead.wetest
to: /home/vagrant/code/wetest/public
should be to: /home/vagrant/code/public

Homestead / Homestead.yaml (Windows) no input file specified

I used to work with homestead on a mac machine, but since i don't have access to that mac machine anymore i'm back on my windows machine.
So today i installed homestead with no problems, ran vagrant up and got: No input file specified.
which is normal because i didn't set my homestead.yaml to the right folders. so this i where i started to ran into problems.
I have a .Projects folder in my user directory and there i have a laravel 5.4 installation called test
this is my homestead.yaml (only the folder's and site's section)
folders:
- map: ~/Projects
to: /home/vagrant/Projects
sites:
- map: test.dev
to: /home/vagrant/Projects/test/public
Still the same message and i realy don't know why i hope someone with homestead + windows can help me !
You need to serve your site from homestead ssh.
serve test.dev /home/vagrant/Projects/test/public
then sudo nginx restart
You need to register your site from homestead first.

Laravel Homestead Installation Error on Windows

I have been trying to set up Laravel Homestead Environment on a local machine. But I was unable to do it.I faced several errors in the installation process. Actually,I am confused with the installation procedure from configuring the SSH Key in the "homestead.yaml" file step.
In the "homestead.yaml" file,How to configure the authorize and keys components according to my local SSH file location against the standard Absolute Path location?
And what exactly is the use of Composer which is being mentioned as a package managing tool?
Is there a good tutorial out there regarding the installation procedure?
Its the first task in my new job and I am really struggling. Any help is really appreciated.
Thanks,
Sri
As you're asking for SSH i assume that you already downloaded Homestead completely (box & clone)and that a Homestead folder is present in you home directory.
First make sure you have Git Bash installed if you're on Windows, Go to your Homestead folder, right click and chose Git Bash then type in this command ssh-keygen -t rsa -C "you#homestead" this will create an SSH key in your folder.
You have to make sure that the keys are named like id_rsa.pub and id_rsa and place them in C:/Users/{username}/.SSH if they're somewhere else, install Composer if you don't have yet go to the folder you want laravel to be in, right click use composer here in next window put this command composer create-project laravel/laravel --prefer-dist
For your authorize key path question this is what you need to put in the Homestead.yaml file authorize: C:/Users/{username}/.ssh/homestead_rsa.pub
for the folders :
folders:
- map: C:/path/to/{local_laravel_project_folder}
to: /home/vagrant/Code
type: "nfs"
sites:
- map: sitename.dev
to: /home/vagrant/Code/Laravel/public
hhvm: true
Open notebook with administrative rights and go to C:\Windows\System32\drivers\etc\hosts and add this line 192.168.10.10 : sitename.dev save the file, run Homestead then in Bash put this command vagrant upand you should see the laravel homepage when you visit sitename.dev .

Laravel Homestead automatically destroys VM

I followed all the instructions on how to setup laravel homestead.
I am using windows 7 and am trying to install laravel homestead on my system.
I have install virtualbox and vagrant.
Every thing seems to go very well however when i run vagrant up homestead VM boots up but fail at some point.
==> 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/digitlimit/Homestead
default: /home/vagrant/Code => C:/server/www
==> default: Running provisioner: file...
==> default: Running provisioner: shell...
default: Running: inline script
==> default: stdin: is not a tty
==> default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0/giyiT0RlisfYwMdHfL7lUSxZtO
kEWX5dJwmwwru5dUQda/xknMa9oHKqAlv//V+VvzQ0JKv4eA3xbCgrlj4NAwoZrEjqVC2P0M3HqT2JKF
M76/WCU4Ki7TQnMQz5ff3aRIqFphNC0LZWXz9v92QjJYohODlOAxIhw94PUimnt3BIzOKxT+kqPuBCOc
+oTJTZwduQsCIb+ArmKVDxNMj1LCL65WrSTaO4CmqqVqiTJ3LkzKm4nNluvy26w5usAKhFs8zrPV0+Jh
DXPI6w9crKzs7y/zSspsENgDdNTuh8wRflUrfGgJMq6LbDVf+Kp6lsjvJMadpn2ABXBY9pr5F emailme#yahoo.com
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: shell...
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
I have provided the full bash commands and logs here:
http://pastebin.com/hcKpF9kA
Kindly view the log above and advise.
Its working now!
I ended up doing a fresh installation of both vagrant and virtualbox.
I took the following steps:
1.
I uninstalled vagrant and Virtualbox and deleted their folders from my system.
I also deleted the following folders:
C:\Users\mysername\.homestead
C:\Users\username\Homestead - vagrant environment
I deleted all the network adapters install by VM
Open Virtualbox and click File -> Preferences, click Network tab and then Host-only networks. Click on each item and click delete button
I download and install fresh copies of Vagrant and Virtualbox.
Am using Windows 7 (32bit)
https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.2.msi
http://dlc-cdn.sun.com/virtualbox/4.3.22/VirtualBox-4.3.22-98236-Win.exe
I also download laravel/homestead manually
https://vagrantcloud.com/laravel/boxes/homestead/versions/0.2.2/providers/virtualbox.box
to my downloads folder C:\Downloads\homestead-0-2-2.box
After i have install Virtualbox and Vagrant. I installed laravel/homestead by running the following command in git bash (you can download git bash here: http://git-scm.com/downloads).
vagrant box add laravel/homestead /c/downloads/homestead-0-2-2.box
Then i downloaded vagrant environment so i can run vagrant commands:
Run this command in Git bash. I run this command inside C:\users\yourusername
git clone https://github.com/laravel/homestead.git Homestead
NB: This will create this folder: C:\Users\yourusername\Homestead
With some files.
Still in Git bash, cd into C:\Users\yourusername\Homestead and run this command:
bash init.sh
NB: this will create a folder C:\Users\yourusername\.homestead that contains Homestead.yaml and some other files
Then Generate an SSH key which you will need when you want to login to your VM by running this command:
ssh-keygen -t rsa -C "youremailaddress#youremail.com"
NB: This will ask some question simply hit enter or type yes and hit enter.
This will create your ssh key inside C:\Users\yourusername\.ssh
Then you need to configure homestead by editing.
C:\Users\digitlimit\Homestead\Homestead.yaml
You can right-click Homestead.yaml file then click open then choose to open with wordpad.
My Homestead.yaml looks this after editing:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: /wamp/www
to: /home/vagrant/Code
sites:
- map: laravel.dev
to: /home/vagrant/Code/laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar
NB: To understand the mapping which is a process of sharing a folder between the host and the VM:
My laravel project is located at C:\wamp\www\laravel
This directory /home/vagrant/Code will be inside the VM after installation.
So what am telling VM is, whenever you see /home/vagrant/Code reference this folder C:\wamp\www\laravel
Also in this:
sites:
- map: laravel.dev
to: /home/vagrant/Code/laravel/public
What we are saying here is when i go to my browser and type http://laravel.dev display the content of /home/vagrant/Code/laravel/public which is actually pointing to C:\www\wamp\laravel\public
After editing Homestead.yaml file save your chnages
NB: Before we can use http://laravel.dev in the host web browser to view our laravel project, we need to add this the following to the hosts file located in
C:\Windows\System32\drivers\etc\hosts
Add this ip address under the list of other ip address listed if any:
192.168.10.10 laravel.dev
Finally, go back to your Git bash, ensure you are in
/c/Users/yourusername/homestead and type:
vagrant up
Wait for vagrant to complete its processes. Click yes when you see any dialog box asking for permission to create network adapter on your system
Well thats all i did. Working for me

Categories