Local (dev) hosts domains ignored, but 'blocking' domains works...? - laravel

I am running Virtual Machine with Laravel project.
Typing 192.168.10.10 in browser re-directs correctly onto Laravel home page.
Typing testing.test is googling 'testing.test'. Tried across IE/Edge, Opera, Chrome.
My Homestead.yaml config is:
sites:
- map: testing.test
to: /home/vagrant/Code/Laravel/public
My hosts file is:
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
192.168.10.10 testing.test
Interestingly - if I add
127.0.0.1 www.stackoverflow.com
Stackoverflow will get 'blocked'.
Also pinging testing.test from commander gives positive response from 192.168.10.10.
Tried flashing DNS, turning off IPv6. Please help :)

Adding http:// in front of testing.test in hosts file helped. Also cleared dns from chrome and opera.
So the hosts file looks now:
192.168.10.10 http://testing.test www.testing.test testing.test

Related

Why am I getting the Apache2 welcome page instead of the laravel page?

I installed laravel via homestead, but when I go to localhost I get the apache2 welcome/success screen. I can't get the Laravel welcome page to load up.
I ran vagrant up on the homestead box but there were no laravel files. So I installed it using composer create-project --prefer-dist laravel/laravel app.
Now when I go to localhost I get the apache2 welcome screen. If I put an index.html in /vagrant I can get that to load up by going to localhost:8000. But going to the same address without the index file causes a 403.
I've tried all combinations of URLs, /app, /app/app, /app/public, and I've tried changing the URL in the .env.
Weirdly, I can't find this apache welcome file on the server. The page itself says "You should replace this file (located at /var/www/html/index.html)" If I SSH in and go to that folder, there is an nginx welcome html page there, but no apache one.
If I go to file:///var/www/html/ in the browser, I see the index.html of the apache welcome page. If I go to file:///var/ I see a few different folders there than I do by SSHing into the vagrant box. I don't understand why.
How can I get the Laravel welcome page to appear?
edits:
http://localhost:8000/public returns "No input file specified"
Sites part of homestead.yaml
sites:
-
map: homestead.test
to: /home/w/work/qs/app/public
/etc/hosts:
127.0.0.1 localhost
127.0.1.1 qs qs
192.168.10.10 homestead.test
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
#### HOMESTEAD-SITES-BEGIN
# 127.0.0.1 homestead.test
#### HOMESTEAD-SITES-END
You need to add hosts entries for each site and the mappings to your Homestead.yaml:
/etc/hosts:
192.168.10.10 homestead.test
~/Homestead/Homestead.yaml:
sites:
- map: homestead.test
to: /home/vagrant/code/my-project/public
Then still under ~/Homestead, run vagrant up --provision.
As per documentation,
you will still need to add an /etc/hosts file entry for homestead.test or the domain of your choice if you are not using automatic
Add domain entry in your /etc/hosts file like:
192.168.10.10 homestead.test
And try brows http://homestead.test from browser
Make sure the IP address listed is the one set in your Homestead.yaml
Edited:
It seems you may running some commands out of the root directory of the project.
Here is the very short video to verify your steps.
https://youtu.be/a9jtoXXp5ao
All the best!

MacOS doesn't resolve localhost to 127.0.0.1 (ignores hosts / apache vhosts)

I ran into the problem, that localhost redirects to a specific domain instead of 127.0.0.1.
My configuration is a local apache/mysql/php installation on MacOS Mojave using vhosts for different projects that are configured in hosts to redirect properly.
When I enter 127.0.0.1 in any browser, I get to my overview page lying in the www root. The same should happen, when I enter localhost in the browser, but instead it redirects to a domain of a project I was working on in the past. It happens also without network connection, so the configuration is on this machine.
My /etc/hosts file:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost project1.local project2.local
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
The first line seems to be ignored and localhost doesn't resolve to 127.0.0.1.
I only have two vhost configurations plus default configuration with no wrong redirection and also the httpd.conf lookes fine. I searched the whole machine with grep -lr "redirectiondomain.com" * without results. I tried with apache switched off with the same result and looked up the MacOS network settings but I can't find anything related to the wrong redirection neither any other solution on stackoverflow or google that solves my issue. Has anybody a clue how the wrong redirection of localhost could be set somewhere else?
Edit: My hostname in MacOS is set. I tried localhost without port, with :80 and :8080

Safari can’t connect to the server local host

Whenever I start Tomcat, and open http://localhost:8080 I get the following error.
Safari can’t open the page “localhost:8080” because Safari can’t connect to the server “localhost”.
It used to work before today. All I did earlier today was block some websites using the host files, but I restored them back again, and now it looks like this.
#
##
# Host Database
#
#
# localhost is used to configure the lookback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
If I start and stop the server using Eclipse, it works. But localhost can’t connect to server using Safari or Google Chrome either..
I know there are a lot of similar questions, but none of them seemed to help.
Thanks a lot in advance!

Homestead project runs only when used 127.0.0.1 in the hosts file

I am new to the Homestead and virtualbox/vagrant world. I went through some video tutorials on how to strat working with Homestead.
Everything went smoothly until the last step. It says we need to add the IP address mention in the Homestead.yaml file into the hosts file.
I did that, but it always gave me the following error:
This site can’t be reached
dev.test refused to connect.
Search Google for dev test 8000
ERR_CONNECTION_REFUSED
My hosts file looks something like this:
192.168.10.10 dev.test
But when I use 127.0.0.1 dev.test it works perfectly fine.
I don't know what's happening.
Even the official documentation says we should 192.168.10.10 dev.test in the /etc/hosts file.
Where am I going wrong??
Here's my Homestead.yaml file
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/laravel.pub
keys:
- ~/.ssh/laravel
folders:
- map: /var/www/Laravel
to: /home/vagrant/Laravel
sites:
- map: dev.test
to: /home/vagrant/Laravel/test/public
databases:
- homestead
Looks like I found my mistake.
I was trying to access my web app using port 8000 even after using 192.168.10.10 dev.test in the hosts file. I should have simply used dev.test in the browser to access the web app.
Silly Mistake.
I makes perfect sense to use dev.test:8000 in the browser if the hosts file reads 127.0.0.1 dev.test

homestead machine is running but urls not found

I am using homestead and it is my first time. now i can run the homestead up and machine starts.
i edited the homestead.yaml file and i edited hosts file but when i try to go to my website in the browser it says that the webpage is not available.
for more information i am using windows and virtual box and here is my hosts file
127.0.0.1 localhost
192.168.10.10 exam.dev
i am wondering what can i do to fix this problem. what i am missing here?
Edit: i tried to ping the 192.168.10.10 but it says that destination host is unreachable

Resources