简体   繁体   English

OSX:Chrome 无法连接到 .localhost-domains。 拒绝连接

[英]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.我有一个运行 nginx + php-fpm 的本地开发设置,其中我使用 .localhost 作为每个项目的工作域。 Yesterday Chrome stopped working with the local domains.昨天 Chrome 停止使用本地域。 Instead it just returns connection refused.相反,它只是返回连接被拒绝。 DevTools shows the error as (failed) net::ERR_CONNECTION_RESET . DevTools 将错误显示为(failed) net::ERR_CONNECTION_RESET

Accessing http://127.0.0.1 works, but of course won't work with the local projects.访问http://127.0.0.1有效,但当然不适用于本地项目。

Safari continues to work with.localhost. Safari 继续使用 .localhost。

Chrome: Version 90.0.4430.212 (Official Build) (x86_64) OS: macOS 11.4 (20F71) Chrome:版本 90.0.4430.212(官方构建)(x86_64) 操作系统:macOS 11.4 (20F71)

Tried several different things like:尝试了几种不同的方法,例如:

  • updating /etc/hosts更新 /etc/hosts
  • clearing DNS for Chrome chrome://net-internals/#dns为 Chrome 清除 DNS chrome://net-internals/#dns
  • removing domains from chrome://net-internals/#hstschrome://net-internals/#hsts删除域

Solution was found after creating a netlogs from chrome://net-internals/#events and then looking at the different events.从 chrome://net-internals/#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. Chrome 似乎默认使用 IPv6。

Solution Adding listen [::]:80 ipv6only=off;解决方案添加listen [::]:80 ipv6only=off; to nginx site configuration and restarting nginx.到 nginx 站点配置并重新启动 nginx。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法连接到 mongodb errno:61 连接被拒绝 - Cannot connect to mongodb errno:61 Connection refused mongo连接拒绝osx - mongo connection refused osx MySQL连接在本地主机上被拒绝 - Mysql connection refused on localhost MacOSX 连接上的 localhost 被拒绝 - localhost on MacOSX connection refused OSX上的Docker应用程序拒绝连接 - Connection refused for Docker application on OSX 拒绝连接到本地主机上的虚拟主机 - Refused to connect to virtual host on localhost SSH -L 连接成功,但本地主机端口转发不起作用“通道 3:打开失败:连接失败:连接被拒绝” - SSH -L connection successful, but localhost port forwarding not working "channel 3: open failed: connect failed: Connection refused" psql:无法连接到服务器:连接被拒绝服务器是否在主机“ localhost”(:: 1)上运行并在端口5432上接受TCP / IP连接? - psql: could not connect to server: Connection refused Is the server running on host “localhost” (::1) and accepting TCP/IP connections on port 5432? 无法连接到服务器:localhost / 127.0.0.1:9000:尝试一次失败。 java.net.ConnectException:连接被拒绝 - Failed to connect to server: localhost/127.0.0.1:9000: try once and fail. java.net.ConnectException: Connection refused MAC OSX:无法运行多个本地域 - MAC OSX: Cannot run multiple local domains
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM