where does localhost name get resolved on windows? - windows

clearly localhost name on windows is resolving on same place other than hosts file:
line 127.0.0.1 localhost has a # on the beginning so it will be ignored
on lines above, it's said that localhost gets resolved within DNS itself
I've set a custom local URL on hosts file (via Laragon) which is working fine on normal situation; however, when I connect my vpn extension on chrome, this & all other defined local names fail to load page:
dial tcp: lookup <URL> on 127.0.0.11:53: no such host
well, all except localhost. localhost domains get resolved on all situation & I'm thinking this is because localhost is defined on someplace deeper than hosts file; & if that place can be modified, then I can add my domain to it so my domain will work on every situation too.
so where does localhost get resolved on windows & how can i add custom names in that place?

Related

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

Hosts file ignored Mac 10.11.4 El Capitan

I am running a RoR app on my local. I have some translations in my hosts file.
127.0.0.1 localhost
127.0.0.1 example.dev
127.0.0.1 www.example.dev
127.0.0.1 api.example.dev
They were working fine, until I updated my OS to 10.11.4. If I send ping request to www.example.dev, it seems to work fine. The IP it translates to is 127.0.0.1.
But when I visit www.example.dev in my web browser, it seems to ignore hosts file and ping DNS server for IP.
I am not sure how, but going to localhost in browser does translate to 127.0.0.1.
Dont know why but ive disabled my lookback adapter and ipv6 and now its working.
so in your host file disable these two items
# ::1 localhost
# fe80::1%lo0 localhost
Some fubar osx bug... I miss steve....
I came across this while searching for an answer to a similar problem and wanted to post my findings for anyone else in the same position.
As a team of three, we found that edits to my /etc/hosts file appeared to work, while editing the other two's host files seemingly did not. Upon further digging, we realized I was on OS X 10.10, while they were on newer versions.
We found, after trying about a million things, that additions to the hosts file in 10.11 and up apparently could not have more than one space between the IP and the domain, for example:
DID NOT WORK:
1.2.3.4 some.site.com
DID WORK:
1.2.3.4 some.site.com
After making this change, we immediately started seeing expected results without any cache clears, reboots, or otherwise.
The host you are overriding is resolving via IPV6. ::1 is the loopback address for IPV6 which is analogous to 127.0.0.1 in IPV4. Add the following entries as the last lines in your /etc/hosts file.
::1 localhost::1 www.example.dev

website 404 error from external webbrowser

I can't get access to my website from external over the ip adress.
this works:
localhost/my_website // shows my web_site
https://IP-adress/ // I see xampp startpage
this doesn't work:
https://IP-adress/my_website //-> I get 404 error
when i add to the httpd.config file "listen 443" or "listen 80" the server doesn't start.
info: I'm using lubuntu(ubuntu)
Edit:
at pre-conclusion at least it has nothing to do with "listen "
The point is that just the folder /my_website,which shows my_website can't be shown from external computer,but xampp for an example is shown from external
I
You probably need to specify a host address, as well as a port. It's been a few years since I used xampp, but I'm guessing it defaults to localhost if no address is explicitly provided.
So, rather than "listen 80"/"listen 443", try "listen <ip address>:80"/"listen <ip address>:443".
For example: "listen 0.0.0.0:80" would allow you to reach your server from your local machine using both localhost and 127.0.0.1.

Hosts file redirect to local computer directory

I have a local Apache server running on my desktop which allows me to run a local site which I want to access from my laptop.
I'm able to access the computer in my hosts file using '192.168.0.5 liam.pc' but I can't figure out how to enter a directory. I've tried '192.168.0.5/Hudex/public hudex.dev' but it doesn't seem to work.
How can I accomplish the effect I want?
HOSTS file:
127.0.0.1 localhost
127.0.0.1 zheil.dev
192.168.0.5 liam.pc

Having a url of : 'example.com' instead of 'localhost:8888/drupal' [Mamp]

How can i run local tests ( with mamp ) that have urls of this kind : www.example.com instead of http://localhost:8888/install.folder
Thank you
If your tests are truely local, you may simply add an alias in your hosts file (/etc/hosts on linux). This alias will cause your computer to resolve www.example.com as 127.0.0.1 (localhost).
If you wish to use this outside of your computer, you will need to purchase a domain, and set its DNS up to forward to your IP address (and open the appropriate port in your router to forward to your computer).
If you don't want to have to include the port number (':8888'), change the port that your server is being hosted on to the default (80). This may be done through the server's configuration file by changing the 'Listen' directive.
If you do not want to have to add the '/drupal' path, add an 'Alias' directive to redirect the user from the root path ('/') to '/drupal'. You may also change the 'DocumentRoot' to drupal.
You will need to add an entry to your hosts file like this:
127.0.0.1 www.example.com
Note: this will not keep you from having to enter the port number or directory - it will only allow you to use a host alias for the host name itself.

Resources