Laravel 5.2 not working with vagrant homestead php 7 - linux

System & Tools:
OS: Ubuntu 14.04 64bit
vagrant_1.8.1_x86_64
virtualbox-5.0_5.0.12-104815~Ubuntu~trusty_amd64
(VM) https://atlas.hashicorp.com/laravel/boxes/homestead-7/versions/0.2.1/providers/virtualbox.box
Im having problem with laravel & vagrant setup. The same setups used to work with laravel 5.1 but now with 5.2 its stopped working.
When I open the URL http://laravel.app it redirect to my localhost page not laravel app.
But if i do http://laravel.app:8000/ it gives Unable to connect firefox can't establish a connection to the server at laravel.app:8000.
Please guide me what i'm doing wrong. i'm new to laravel and vagrant and did managed to run 5.1 few weeks ago but now 5.2 is stcuk with virtualbox php 7
Instructions followed from laravel site:
https://laravel.com/docs/5.2
https://laravel.com/docs/5.2/homestead
~.homestead/Homestead.yaml
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/www/sites
to: /home/vagrant/Code
sites:
- map: laravel.app
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
hosts
127.0.0.1 localhost
127.0.1.1 raven
192.168.10.10 laravel.app
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
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)

Your /etc/hosts file should point your domain to 127.0.0.1, this is because homestead forwards 127.0.0.1:8000 to port 80 on your vagrant box. In this case 192.168.10.10:80.
So your /etc/hosts should look like this
127.0.0.1 laravel.app
In your browser you should then access http://laravel.app:8000/

Thanks to #Wader for helping me out. With his help I found the problem.
Coming from Windows user experience the case sensitive names got me this time.
The homestead.yaml file had Laravel as site directory while my directory name was in lower case laravel. I capitalised the directory and it worked. Along with the IP change and appending the port as suggested by #Warden

Try placing
box: laravel/homestead-7
at the top of your homestead.yaml file
Then in terminal enter homestead ssh
then type in serve laravel.app /home/vagrant/Code/laravel/public

Related

localhost defaults to ipv6 address instead of ipv4 on fedora linux. Can't connect to mongodb from nodejs

After a system update on Fedora 36 Linux, Localhost alias now uses the ipv6 address by default which has broken a lot of my code.
For instance:
// Connecting to MongoDB using mongoose on express (nodejs)
mongoose.connect('mongodb://localhost:27017/farmStand')
.then(()=>{
console.log('Connected to Mongo');
})
Does not work and throws this error:
MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
I've done some research and found multiple workarounds such as replacing localhost with 127.0.0.1, localhost4 or even removing the following line,
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
from from /etc/hosts,
# Loopback entries; do not change.
# For historical reasons, localhost precedes localhost.localdomain:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# See hosts(5) for proper format and other examples:
# 192.168.1.10 foo.mydomain.org foo
# 192.168.1.13 bar.mydomain.org bar
However since this the former forces me to change a lot of code and the later is not recommended by the hosts file itself,
How do i return localhost to its former state or bind mongodb to ipv6?
Start your MongoDB with this settings:
net:
bindIpAll: true
ipv6: true
Then it should work

Ubuntu local IP address does not resolve

I set a Hugo web server, which listen on localhost:30000.
The ubuntu machine has the 192.168.2.137 address.
When i do:
curl http://localhost:30000/ -> OK
curl http://127.0.0.1:30000/ -> OK
but,
curl http://192.168.2.137:30000/ -> curl: (7) Failed to connect to 192.168.2.131 port 30000: Connection refused
What could be the reason for that?
My /etc/netplan/00-installer-config.yaml looks like:
network:
version: 2
renderer: NetworkManager
ethernets:
enp0s3:
dhcp4: false
addresses: [192.168.2.137/24]
gateway4: 192.168.2.1
nameservers:
addresses:
- 8.8.8.8
lo:
renderer: networkd
match:
name: lo
addresses:
- 192.168.2.137/24
I also add an entry to /etc/hosts:
192.168.2.137 localhost
You said that it’s listen on localhost so if you use other interface it won’t work which is normal . You should listen on all interfaces or listen to the interface enp0s3.

".local" suffix on local server (Manjaro)

I recently changed my Linux distribution (Manjaro) and my local domains defined in /etc/hosts and ending in .local no longer work.
# /etc/hosts
# Host addresses
127.0.0.1 localhost
127.0.0.1 hello.local
127.0.0.1 hello.domain.local
127.0.0.1 hello.other
$ ping hello.local
ping: hello.local: Nom ou service inconnu
$ ping hello.other
PING hello.other (127.0.0.1) 56(84) octets de données.
64 octets de localhost (127.0.0.1) : icmp_seq=1 ttl=64 temps=0.012 ms
...
$ ping hello.domain.local
PING hello.domain.local (127.0.0.1) 56(84) octets de données.
64 octets de localhost (127.0.0.1) : icmp_seq=1 ttl=64 temps=0.012 ms
...
This doesn't work only with a sub-domain of the tld .local : hello.local.
If it's a sub-sub domain : hello.domain.local , it works.
Also if the tld is not (.local) but .other : hello.other, it works.
where did I miss something?
Firstly, backup your nsswitch.conf ->
sudo cp /etc/nsswitch.conf /etc/nsswitch.conf.bk
Then, goo to /etc/nsswitch.conf and
replace this line
hosts: mymachines mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] files myhostname dns
to
hosts: files mdns4_minimal [NOTFOUND=return] dns

Vagrant box timeout value while waiting for machine to boot

In windows i added homestead and try to run
vagrant up
It executed and shows me the following error
$ vagrant up
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Importing base box 'laravel/homestead'...
==> homestead-7: Matching MAC address for NAT networking...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
==> homestead-7: A newer version of the box 'laravel/homestead' is available! Yo u currently
==> homestead-7: have version '3.0.0'. The latest is version '3.1.0'. Run
==> homestead-7: `vagrant box update` to update.
==> homestead-7: Setting the name of the VM: homestead-7
==> homestead-7: Clearing any previously set network interfaces...
==> homestead-7: Preparing network interfaces based on configuration...
homestead-7: Adapter 1: nat
homestead-7: Adapter 2: hostonly
==> homestead-7: Forwarding ports...
homestead-7: 80 (guest) => 8000 (host) (adapter 1)
homestead-7: 443 (guest) => 44300 (host) (adapter 1)
homestead-7: 3306 (guest) => 33060 (host) (adapter 1)
homestead-7: 5432 (guest) => 54320 (host) (adapter 1)
homestead-7: 8025 (guest) => 8025 (host) (adapter 1)
homestead-7: 27017 (guest) => 27017 (host) (adapter 1)
homestead-7: 22 (guest) => 2222 (host) (adapter 1)
==> homestead-7: Running 'pre-boot' VM customizations...
==> homestead-7: Booting VM...
==> homestead-7: Waiting for machine to boot. This may take a few minutes...
homestead-7: SSH address: 127.0.0.1:2222
homestead-7: SSH username: vagrant
homestead-7: 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.
I tried many things but it shows me the same error again and again. I do know what to do.Could any one help me to solve this
Have you enabled the VM in your BIOS? If it's the 1st time you are doing it, you need to enable it, it's locked by default.

What is the correct /etc/hosts format?

Recently I am started having issue with /etc/hosts file on hadoop nodes. Each host has private & public IP.
Some of the previous setup was with the following format
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.0.3.62 client01.dev.abc.com client01
and new hosts with following format
127.0.0.1 client01.dev.abc.com localhost.localdomain localhost
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
I am still confuse with it. Any help ?
Thanks
just do
nano /etc/hosts
and then add these below the lines which are already present,
192.168.1.15 hadoop-master
192.168.1.16 hadoop-slave-1
192.168.1.17 hadoop-slave-2
These IP addresses should be local/Private addresses.

Resources