【问题标题】:Fresh Valet install not pinging .test新鲜代客安装不ping .test
【发布时间】:2022-10-05 14:11:23
【问题描述】:

我正在尝试让 Valet 在运行 macOS 12.3 的新 MacBook Pro 上运行。 Homebrew、PHP 和 Composer 都安装得很好并且运行良好(据我所知)。

但是,一旦我安装 Valet 并尝试 ping foobar.test,它就不会返回 127.0.0.1(它是一些 198.#.#.# IP),我也无法在浏览器中访问它。我收到一条 ERR_CONNECTION_RESET 消息。

如果我直接在浏览器中访问127.0.0.1localhost,我会收到我期望的“404 - Not Found”代客信息。

运行brew services list,我得到以下信息:

Name    Status     User File
dnsmasq error  512 root ~/Library/LaunchAgents/homebrew.mxcl.dnsmasq.plist
mariadb started    root ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
nginx   error  256 root ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
php     started    root ~/Library/LaunchAgents/homebrew.mxcl.php.plist
unbound error  256 root ~/Library/LaunchAgents/homebrew.mxcl.unbound.plist

“错误”状态似乎很可疑,但多年来我一直在与 Valet 以前的机器作斗争工作。

我试过重新启动我的 MacBook,重新启动 Valet(也称为 sudo),并删除/重新安装 Valet。似乎没有任何帮助。

不确定要尝试什么,因为在安装过程中没有任何结果导致错误。所有社区帖子似乎都指向重新安装 Valet,如前所述,这似乎没有帮助。

有任何想法吗?

【问题讨论】:

    标签: macos command-line homebrew dnsmasq laravel-valet


    【解决方案1】:

    卸载 FortiClient,问题就消失了。查看您是否有任何 VPN 客户端或已安装。

    【讨论】:

    • 我确实安装了 FortiClient 并将其删除并重新安装了 Valet,但问题仍然存在。我将看看是否可以找到更多旧的配置文件来删除并尝试重新安装。
    • 检查/etc/resolver/
    【解决方案2】:

    我以前遇到过这个问题,并发现使用 FortiClient 的根本原因是它在 OSX 中启用了pf 防火墙并具有 NAT DNS 重定向。

    为了验证我在运行sudo pfctl -s nat 时看到的内容,给了我一行,其中包含:
    rdr pass inet proto udp from any to any port = 53 -> 127.0.0.1 port 53535

    如果您需要 FortiClient 并且还需要在本地开发中使用代客服务,那么已经找到了一些解决方法:

    • 重置pf的配置
    • 编辑 /etc/hosts 以静态添加主机(尽管如果很多,更改主机,这不会扩展)

    要重置 PF,我会执行以下操作:

    # reset the rules based off the on-disk version
    sudo pfctl -N -f /etc/pf.conf
    
    # clear the DNS cache on system
    sudo dscacheutil -flushcache
    sudo killall -HUP mDNSResponder
    

    检查pf 中的 NAT 规则后,我得到以下默认响应:

    $ sudo pfctl -s nat
    No ALTQ support in kernel
    ALTQ related functions disabled
    nat-anchor “com.apple/*” all
    rdr-anchor “com.apple/*” all
    

    注意:重置 pf 的配置可能会产生一些其他副作用,尽管根据我过去一个月使用它的经验,它似乎对我的设置没有任何问题

    【讨论】:

      猜你喜欢
      • 2020-12-04
      • 2019-09-30
      • 1970-01-01
      • 2014-06-23
      • 1970-01-01
      • 2017-01-13
      • 1970-01-01
      • 2022-07-01
      • 2019-06-14
      相关资源
      最近更新 更多