windows 如何从同一网络中的另一台计算机访问本地主机?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19482164/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 11:00:17  来源:igfitidea点击:

How can I access localhost from another computer in the same network?

windowsapachewampwampserver

提问by user2735791

I just recently downloaded WAMP Server to view and edit php webpages but now I would also like other people in my network (connected to the same wifi) to be able to access localhost and all the files that I have saved. I have already tried to access localhost and my WAMP server was already online, however that didn't work. Can someone help me out? Thanks in advance!

我最近刚刚下载了 WAMP 服务器来查看和编辑 php 网页,但现在我还希望我网络中的其他人(连接到同一个 wifi)能够访问 localhost 和我保存的所有文件。我已经尝试访问 localhost 并且我的 WAMP 服务器已经在线,但是这不起作用。有人可以帮我吗?提前致谢!

回答by Tri Hoang

You need to find what your local network's IPof that computer is. Then other people can access to your site by that IP.

您需要找到该计算机的本地网络 IP。然后其他人可以通过该 IP 访问您的站点。

You can find your local network's IP by go to Command Promptor press Windows+ Rthen type in ipconfig. It will give out some information and your local IP should look like 192.168.1.x.

您可以通过转到命令提示符或按Windows+R然后输入来查找本地网络的 IP ipconfig。它会给出一些信息,你的本地 IP 应该看起来像192.168.1.x

回答by Jonathan K

localhost is a special hostname that almost always resolves to 127.0.0.1. If you ask someone else to connect to http://localhostthey'll be connecting to their computer instead or yours.

localhost 是一个特殊的主机名,几乎总是解析为 127.0.0.1。如果您让其他人连接,http://localhost他们将连接到他们的计算机或您的计算机。

To share your web server with someone else you'll need to find your IP address or your hostname and provide that to them instead. On windows you can find this with ipconfig /allon a command line.

要与其他人共享您的网络服务器,您需要找到您的 IP 地址或主机名,并将其提供给他们。在 Windows 上,您可以ipconfig /all在命令行上找到它。

You'll also need to make sure any firewalls you may have configured allow traffic on port 80 to connect to the WAMP server.

您还需要确保您可能配置的任何防火墙都允许端口 80 上的流量连接到 WAMP 服务器。