I've been facing this problem in mountain lion 10.8.3 and I cannot seem to find an answer. The problem is that I can access my "localhost" using username.local or http://127.0.0.1/ but not through localhost. I'm using apache 2.2 and virtualhostx, and for now is fine becuase I map every virtual host with a folder, but when developing in java, using Tomcat, I cannot access localhost, also there I have to access username.local..
my hosts file
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
If I cant find a solution I only can think of a fresh reinstall.. And this will be very annoying..
check your httpd.conf for this line
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf
i had the same issue. Then i discovered that the httod-vhosts.conf file was commented out when i upgraded my OS.
Related
Currently im trying to host a drupal 8 website in my local using MAMP in MAC (bigSur)
but unfortunately, it has a weird behaviour that it takes more than 10 mins to load a single page when connected to the internet. but without internet it loads faster (if i disabled the wifi)
I have seen that it can cause I'm using a .local address. I have tried the followings
cleared DNS cache using sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder
adding ::1 myservername.local hostname to support ipv6
switch off ipv6 using the command networksetup -setv6off Wi-Fi
adding hosts in same line like 127.0.0.1 localhost myservername.local
adding hosts in ipv6 in same line like ::1 localhost myservername.local
added fe80::1%lo0 localhost and fe80::1%lo0 myservername.local
changed <VirtualHost *:80> to <VirtualHost 0.0.0.0:80>
still, I'm having the same slowness and nothing worked for me.
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
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
From httpd -v, I get the below:
Server version: Apache/2.4.16 (Unix)
Server built: Aug 22 2015 16:51:57
Also, etc/hosts is as follows:
##
# 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
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
I start the server using sudo apachectl start and it returns no error. However, I am not able to connect to localhost on a web browser. Would you suggest a solution? Thanks for your time.
Please see if https://donatstudios.com/PHP-in-OS-X-Yosemite helps you re-configure the httpd.conf
If you don't need IPv6 there is an easy fix for this.
I was all of a sudden unable to access localhost:631 (CUPS).
I Changed IPv6 to link-local.
Problem solved.
I am trying to do an install of Oracle Forms and Reports on Weblogic 10.3.6. I am using virtual box and Oracle Linux 6.5.
Forms and Reports keeps failing on 'Executing: opmnctl startproc ias-component..'
After looking through what logs are avaiable and searching the net, I think the problem lies with my etc/hosts file - but I do not understand why or how to fix it.
My etc/hosts file consists of
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost.localdomain6
I also tried changing this file to
127.0.0.1 localhost localhost4
::1 localhost localhost6
Does anyone know what I should have in this file?
Usually you will leave the hosts file with the defaults and use DNS for name resolution. I would verify the DNS settings for your server. Then use ping to test name resolution.