简体   繁体   English

我的本地主机拒绝在 MacOS 上连接

[英]My localhost is refusing to connect on MacOS

I am running XAMPP and trying to test my PHP but cant get my localhost to connect.我正在运行 XAMPP 并尝试测试我的 PHP 但无法让我的本地主机连接。 I have tried directing it to different ports and nothing has improved, i have tried kill httpd and stop the apache control and restarted XAMPP, still no joy.我试过将它引导到不同的端口,但没有任何改善,我试过杀死 httpd 并停止 apache 控制并重新启动 XAMPP,仍然没有乐趣。 Any advice?有什么建议吗?

You probably installed the virtual machine version of XAMPP (eg xampp-osx-7.4.4.0-vm.dmg ).您可能安装了 XAMPP 的虚拟机版本(例如xampp-osx-7.4.4.0-vm.dmg )。 It does not run natively on your machine, but inside a box and with its own local network IP address.它不是在您的机器上本地运行,而是在一个盒子内并具有自己的本地网络 IP 地址。 It cannot be reached via localhost or 127.0.0.1 by default, because they only refer to the host system.默认情况下无法通过localhost127.0.0.1访问它,因为它们仅指主机系统。 The guest system should be seen like another machine in the LAN.来宾系统应该被视为局域网中的另一台机器。

You can find the IP address of the guest system in the General tab of the XAMPP app.您可以在 XAMPP 应用程序的常规选项卡中找到来宾系统的 IP 地址。 In my case it is 192.168.64.2 .就我而言,它是192.168.64.2 If I enter that in a browser then I get redirected to the XAMPP dashboard ( Welcome to XAMPP for 7.4.4-0 ).如果我在浏览器中输入它,那么我会被重定向到 XAMPP 仪表板(欢迎来到 XAMPP for 7.4.4-0 )。

You may enable port forwarding in the Network tab of the XAMPP app.您可以在 XAMPP 应用程序的网络选项卡中启用端口转发 Select localhost:8080 -> 80 (Over SSH) and click the Enable button. Select localhost:8080 -> 80 (Over SSH)并单击启用按钮。 You should then be able to reach the XAMPP dashboard via localhost:8080 .然后,您应该能够通过localhost:8080访问 XAMPP 仪表板。

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

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