I've been trying to set up a second Laravel 5 app on my local Homestead space. I have been following the instructions from the official documentation and from this blog. (Although I have had to use the specific ID of the provision in order to get the vagrant provision command to work.)
My YAML file looks like this:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: C:\Users\Lisa\Documents\Homestead
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/larapipeline/public
- map: tinkertower.app
to: /home/vagrant/code/tinkertower/public
databases:
- homestead
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
My hosts file looks like this:
127.0.0.1 localhost
192.168.10.10 homestead.app
192.168.10.10 tinkertower.app
I THINK that having gone the provisioning and all that jazz, this should be setting up a starter Laravel app in the tinkertower folder, and that pointing to tinkertower.app should work. The tinkertower folder is empty, however, and trying to visit the site gives me a "server not found," as it's trying to find www.tinkertower.app. I can still get to the homestead.app site. I tried the "serve" command while sshed into homestead, but it didn't make any difference.
So, the questions:
1. Should these steps have added a clean version of Laravel into the tinkertower folder? If not, am I just supposed to grab a new version from Github?
Am I missing something that should get the tinkertower.app link working? I don't know enough to know if the fact that both sites have the same IP address is a problem nor how to fix it, nor if I'm missing something else. (After all, if I go to the IP address 192.168.10.10 directly, I get to the first app.)
Thanks in advance!
Edit 1
Updated 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\Lisa\Documents\larapipeline
to: /home/vagrant/Code/larapipeline
- map: C:\Users\Lisa\Documents\tinkertower
to: /home/vagrant/Code/tinkertower
sites:
- map: homestead.app
to: /home/vagrant/Code/larapipeline/public
- map: tinkertower.app
to: /home/vagrant/code/tinkertower/public
databases:
- homestead
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
Hosts 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
127.0.0.1 localhost
192.168.10.10 tinkertower.app
192.168.10.10 homestead.app
The problem was in your homestead.yaml file.
folders:
- map: C:\Users\Lisa\Documents\Homestead\larapipeline
to: /home/vagrant/Code/larapipelin
- map: C:\Users\Lisa\Documents\Homestead\tinkertower
to: /home/vagrant/Code/tinkertower
sites:
- map: homestead.app
to: /home/vagrant/Code/larapipeline/public
- map: tinkertower.app
to: /home/vagrant/code/tinkertower/public
Don't forget to edit your hosts file. Now run vagrant up --provision, or vagrant reload --provision.
Edit:
Fixed case sensitivity issue on this line.
- map: tinkertower.app
to: /home/vagrant/Code/tinkertower/public
Edit 2:
Sorry another mistake :)
You should put your websites into the same directory your Homestead config directory is in.
+ Documents
|
| --- Homestead
|
| --- larapipeline
|
| --- tinkertower
So all three folders, larapipeline, tinkertower, and Homestead should be in Documents directory.
Anyways final code here (hopefully no more mistakes by me):
folders:
- map: C:\Users\Lisa\Documents\larapipeline
to: /home/vagrant/Code/larapipelin
- map: C:\Users\Lisa\Documents\tinkertower
to: /home/vagrant/Code/tinkertower
sites:
- map: homestead.app
to: /home/vagrant/Code/larapipeline/public
- map: tinkertower.app
to: /home/vagrant/Code/tinkertower/public
Your hosts file:
127.0.0.1 homestead.app
127.0.0.1 tinkertower.app
Edit 3:
You have a case sensitivity issue. I fixed it, just copy and paste these two lines in the correct place.
- map: tinkertower.app
to: /home/vagrant/Code/tinkertower/public
Change your hosts file, just do it and ask questions later.
# 127.0.0.1 localhost you don't need this line
127.0.0.1 tinkertower.app
127.0.0.1 homestead.app
Don't forget to move your actual folders to the correct place
Related
Have currently set up my Homestead.yaml file to map two different folders to two different sites. One is for my API and one is for phpmyadmin. Here are my homestead.yaml and the hosts file.
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: C:\Users\nikulas\Homestead\code
to: /vagrant/code
sites:
- map: dev.api.app
to: /vagrant/code/api/public
- map: dev.phpmyadmin.app
to: /vagrant/code/phpMyAdmin
databases:
- homestead
- subit
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
hosts
# 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
# 192.168.10.10 dev.api.app
# 192.168.10.10 dev.phpmyadmin.app
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
So for everything is mostly working. When running vagrant up and vagrant ssh I can navigate to the code directory on if I ls I have both the api and phpMyAdmin folder. I can make requests to my API in postman like this
192.168.10.10/v2/example-endpoint
The problem is if I try going to either dev.api.app or dev.phpmyadmin.app I get "This site can’t be reached" and I see no way of navigating to phpmyadmin in the browser.
In bash scripts and similar # is for comments, your hosts are basically out commented. For your host file to register your domains correctly, this should be removed.
# 192.168.10.10 dev.api.app
# 192.168.10.10 dev.phpmyadmin.app
Should be.
192.168.10.10 dev.api.app
192.168.10.10 dev.phpmyadmin.app
Well:
I can access the files in the virtul server through vagrant SSH.
I can ping homestead.app through CMD.
I can ping the IP 192.160.10.10 through CMD.
But i can't access it through the browser.
if i enter 127.0.0.1:2222 in browser i get this:
SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
Protocol mismatch.
this is my 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:\projects\PHP
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/smr/public
hhvm: true
databases:
- laraveldb
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
and this is the hosts file:
127.0.0.1 activate.adobe.com
192.168.10.10 homestead.app
I can see a Typo:
sites:
- map: homsetead.app
to: /home/vagrant/Code/smr/public
hhvm: true
Change the map to homestead.app and tell us
I have a some question I'm so confused about this.
I've install homestead for Laravel 5 but I've some problem when I try to access my domain laravel.dev this will redirect to xampp home page.
I was change homestead.yaml and hosts file but it doesn't work.
I was follow this instruction:
https://laravel.com/docs/5.2/homestead
http://ambercat.rahmanda.net/collections/2015/02/18/instalasi-homestead.html
But is not help.
this is my Homestead.yaml
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: C:/xampp/htdocs
to: /home/vagrant/Code
type: "nfs"
sites:
- map: laravel.dev
to: /home/vagrant/Code/laravel-crud/public
databases:
- homestead
And this is my Hosts
# 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
192.168.10.10 laravel.dev
Can anyone help me for this problem?
Please advise
Thankyou..
When using Homestead for local development, by default the IP in Homestead.yaml is set to 192.168.10.10. Example Homestead.yaml with multiple applications looks like this:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: C:/Users/MyUser/.ssh/id_rsa.pub
keys:
- C:/Users/MyUser/.ssh/id_rsa
folders:
- map: C:/Users/MyUser/workspace/projects
to: /home/vagrant/Code
sites:
- map: app1.local
to: /home/vagrant/Code/app1/public
- map: app2.local
to: /home/vagrant/Code/app2/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
Then, this IP is used in hosts file:
192.168.10.10 app1.local
192.168.10.10 app2.local
Let's say I would like to use separate IP for each application. Is it possible? How do I do it?
RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^xxx\.xx\.xx\.[8-9]$ # your ip here
RewriteCond %{REQUEST_URI} !^/index/
RewriteRule .? /index/ [R,L]
The above will redirect based on a certain IP-address.
See this: https://www.siteground.com/kb/how_to_redirect_all_visitors_except_your_ip_to_another_site/
*You can modify things to your needs of course. This are just samples.
I was editing my homestead.yaml file and I am certain the indentation is correct -- I however get this following error:
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:
shell provisioner:
* Shell provisioner `args` must be a string or array.
* Shell provisioner `args` must be a string or array.
* Shell provisioner `args` must be a string or array.
* Shell provisioner `args` must be a string or array.
My homestead.yaml file:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Sites
to: /home/vagrant/Sites
sites:
- map: scheduleify.dev
to: /home/vagrant/Sites/scheduleify/public
- map: phpmyadmin.dev
to: /home/vagrant/Sites/phpmyadmin
- map: articles.dev
to: /home/vagrant/Sites/learning-laravel5
databases:
- scheduleify
variables:
- key: APP_ENV
- value: local
Any ideas on what is wrong with the file?
Last line isn't indented correctly. Make sure it looks like
variables:
- key: APP_ENV
value: local
Also check that all paths on host machine exist.
I had a similar issue but slightly different reason:
variables:
- key: ON_HOMESTEAD
value: true # Error
The value true is invalid and should be 1.
variables:
- key: ON_HOMESTEAD
value: 1