This address: 127.0.0.1:5000 on Mac Catalina not working (docker) but working on Windows - macos

This address: 127.0.0.1:5000 on Mac Catalina not working (docker) but working on Windows.
Question:
How do I get access to port:5000 working on my MAC?
# 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
# Added by Docker Desktop
# To allow the same kube context to work on the host and the
container: 127.0.0.1 kubernetes.docker.internal
# End of section

Update the line ## 127.0.0.1 localhost to 127.0.0.1 localhost in your /etc/hosts file.
Basically # is used for commenting in bash.
After that, you will be able to access using 127.0.0.1:5000 and http://localhost:5000

Related

Mac won't connect to localhost server run from VirtualBox

My mac won't connect to localhost, I've tried with Safari and Mozilla, so it's not the browser, I tried other solutions I found on the internet, I ping 127.0.0.1 and it works correctly, if I run dscacheutil -q host -a name localhost I get the following:
name: localhost
ipv6_address: ::1
name: localhost
ip_address: 127.0.0.1
If I run apachectl configtest I get Syntax OK.
I've also read that my /etc/hosts might have been corrupted, this is how it looks like:
##
# 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
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
I have no idea what else to try
EDIT: I'm trying to run an application (Hortonworks Sandbox) from a virtual machine (VirtualBox) in mac, I was advised to try port forwarding but this is what I see when I check the port forwarding in VirtualBox, seems like everything is in order:
I also tried to run Vagrant from VirtualBox and Mac couldn't connect to the localhost server when needed

Can't access 127.0.0.1 apache 2 (MacOS X)

After my MacBook Pro mid2009 has been updated to MacOS X El Capitan I found that many things don't work anymore as they were before.
Built-in apache2 is not aviable on http://127.0.0.1 but aviable on http://localhost. In Yosemite both of them was working properly.
/private/etc/hosts looks like that:
##
# 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
It's looks strange cuz 127.0.0.1 and localhost are the same thing.
Any idea what's going on?
httpd.conf
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
In your httpd.conf, you will have a Listen directive, this will be the ip address / port that the server will bind to.
In your conf file you have defined
Listen 80
That is stating that you should bind to all interfaces on port 80, this will include both IPv4, and IPv6;
Disabling IPv6 should would, change this line to
# allow access on all interfaces
Listen 0.0.0.0:80
# or for local access only
# Listen 127.0.0.1:80
# or more specifically
# Listen 192.168.0.0:80
# To listen on a specific subnet
To figure out why the site will not load when accessed via IPv6, would require additional error / debug logs.

Mac localhost is not available after upgrade to OSX El Capitan 10.11.1

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.

gethostbyname fail after switching internet connections

I often (but not always) get the following error when running MPI jobs after switching wifi hosts.
Fatal error in MPI_Init: Other MPI error, error stack:
MPIR_Init_thread(498)..............:
MPID_Init(187).....................: channel initialization failed
MPIDI_CH3_Init(89).................:
MPID_nem_init(320).................:
MPID_nem_tcp_init(171).............:
MPID_nem_tcp_get_business_card(418):
MPID_nem_tcp_init(377).............: gethostbyname failed, MacBook-Pro.local (errno 1)
Everything works fine in the coffee shop, and then when I come home, I get the above error. Nothing else has changed.
I've checked the /etc/hosts and /private/etc/hosts files, and they look okay -
##
# 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
I can ping localhost, so the problem isn't exactly that localhost isn't resolved.
Rebooting always fixes the problem, but is there something simple I can do to "reset" my system so that it recognizes local host?
I don't have access to the details of the MPI initialization routines in the code I am running and am not making any explicit calls to gethostname.
I am using MPICH 3.1.4 (built Feb, 2015) and am running OSX 10.10.3
The answer is very simple - here is what seems to work.
I edited the file /etc/hosts (or /private/etc/hosts, in OSX) and added the line
127.0.0.1 macbook-pro.local
so now my hosts files looks like :
##
# 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
127.0.0.1 macbook-pro.local
We were facing this issue intermittently on our CI server. It seems that setting the environment variable MPICH_INTERFACE_HOSTNAME to localhost helped.

Installing Glassfish 3 on Mac OS X 10.8.2 fails in Domain Info setup

I am a Glassfish newbie, though a Java and Unix veteran. I am running the shell script to install Java EE 6 SDK, including Glassfish 3 on my Mac.
bash-3.2# sh java_ee_sdk-6u4-unix.sh
Everything goes along fine until I get to the Domain Info screen. I am sticking with the default info (except for passwords):
Domain Name: domain1
Admin Port: 4848 <- I have verified with netstat that both ports are free
Http Port: 8080 <-
Username: admin
Password: xxxxxxxxxxxx
Service Name: domain1Service
+ Start domain after creation
When I click Next, I get 2 error dialogs that tell me the following:
Admin Port: Host name not found
Http Port: Host name not found
Does anyone know how to get past this?
I confirm, I correct the same problem by changing my hostname to localhost using the command line hostname localhost in linux.
Looks like something is wrong with your network config. Maybe your hosts file is missing the entry for localhost.
Check the file /private/etc/hosts for
127.0.0.1 localhost
You can also try to set your hostname with
sudo hostname localhost
The answer was relatively simple. I had to add the hostname configured with MacOS Settings as an alias for localhost into my /etc/hosts file. I'm not sure where MacOS keeps the host name. But the hostname command (i.e. gethostname) was returning 'airguitar', which is what Glassfish was trying to connect to. Since it wasn't in /etc/hosts, the hostname couldn't be found.
This is a problem that happens on many systems, It's happening on my linux as well. The solution is quite simple, as chuck almost got it.
Check your hosts file, on linux is under /etc/hosts. You'll probably have a file like this:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Check your hostname with the command hostname
[root#glassfish1 opt]# hostname
glassfish1
And add this host name to your hosts file like this:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 glassfish1
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
this did the trick for me.

Resources