简体   繁体   中英

OSX : Chrome cannot connect to .localhost-domains. Connection refused

This have me stumped.

I have a local development setup running nginx + php-fpm where I'm using.localhost as working domain for each project. Yesterday Chrome stopped working with the local domains. Instead it just returns connection refused. DevTools shows the error as (failed) net::ERR_CONNECTION_RESET .

Accessing http://127.0.0.1 works, but of course won't work with the local projects.

Safari continues to work with.localhost.

Chrome: Version 90.0.4430.212 (Official Build) (x86_64) OS: macOS 11.4 (20F71)

Tried several different things like:

  • updating /etc/hosts
  • clearing DNS for Chrome chrome://net-internals/#dns
  • removing domains from chrome://net-internals/#hsts

Solution was found after creating a netlogs from chrome://net-internals/#events and then looking at the different events. Found this:

t=18295 [st=0] +SOCKET_ALIVE  [dt=4]
                --> source_dependency = 5112 (TRANSPORT_CONNECT_JOB)
t=18295 [st=0]   +TCP_CONNECT  [dt=1]
                  --> address_list = ["[::1]:80","127.0.0.1:80"]
                  --> canonical_name = ""
t=18295 [st=0]      TCP_CONNECT_ATTEMPT  [dt=1]
                    --> address = "[::1]:80"
t=18296 [st=1]   -TCP_CONNECT
                  --> source_address = "[::1]:56378"
t=18296 [st=1]   +SOCKET_IN_USE  [dt=3]
                  --> source_dependency = 5111 (HTTP_STREAM_JOB)
t=18296 [st=1]      SOCKET_BYTES_SENT
                    --> byte_count = 719
t=18298 [st=3]      SOCKET_READ_ERROR
                    --> net_error = -101 (ERR_CONNECTION_RESET)
                    --> os_error = 54
t=18299 [st=4]   -SOCKET_IN_USE
t=18299 [st=4]    SOCKET_POOL_CLOSING_SOCKET
                  --> reason = "Connection was closed when it was returned to the pool"
t=18299 [st=4] -SOCKET_ALIVE

Chrome seems to default to IPv6.

Solution Adding listen [::]:80 ipv6only=off; to nginx site configuration and restarting nginx.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM