我怎样才能从其他计算机访问我的本地服务器? [英] How can I access my localhost server from other computers?

查看:158
本文介绍了我怎样才能从其他计算机访问我的本地服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的PHP,所以我不知道该如何解释。我在我的计算机上运行WAMP,我希望能够访问来自的我的的本地主机的的另一台计算机的。

这可能吗?我怎样才能做到这一点?


解决方案

  

这是规定,所有机器都在同一个网络上,并且你有
  对计算机的管理权限(你需要编辑一些系统文件)。


您可以轻松地做到这一点,但它必须是一个手动过程。

您必须创建的主机文件中的条目 -


  • 在Windows机器是位于的%SystemRoot%\\ SYSTEM32 \\ DRIVERS \\ ETC \\主机

  • 在类UNIX它位于 / etc / hosts中
  • 系统

<一个href=\"http://en.wikipedia.org/wiki/Hosts_(file)#Location_in_the_file_system\">http://en.wikipedia.org/wiki/Hosts_(file)#Location_in_the_file_system.

看到那里的的hosts文件所在的链接了解详情。这取决于操作系统。


下面将不得不在每次你想搜索的机器上完成
能够访问你的本地主机的机器。

在你的主机的最后添加一行文件与此类似:

  10.0.0.42 prathyash-localhost.com

IP地址(在它上面的例子是 10.0.0.42 )是的的本地主机的地址;您的计算机的IP地址。域名( prathyash-localhost.com )是什么,是的映射
到的IP地址。

在您保存文件,当的的计算机指向 prathyash-localhost.com ,它会被定向到您的IP地址。防火墙仍然是一个障碍 - 但是其他的答案涵盖的,所以我不会重复他们的贡献


根据您的情况,手动编辑几十也许几百个文件可能是不可行的。在这种情况下,你可能会想咨询网络管理员(他可能徘徊在服务器故障),以及他可能给你一个更好的解决方案

I'm new to PHP, so I don't know how to explain it. I'm running WAMP on my computer and I would like to be able to access my localhost from another computer.

Is it possible? How can I do this?

解决方案

This is provided that all machines are on the same network and that you have administrative privileges on the machines (you'll have to edit some system files).

You can easily do this but it would have to be a manual process.

You have to create an entry in the hosts file -

  • On Windows machines is is located in %SystemRoot%\system32\drivers\etc\hosts
  • On UNIX like systems it is located in /etc/hosts

http://en.wikipedia.org/wiki/Hosts_(file)#Location_in_the_file_system.
See the link for details on where your hosts file is located. It depends on the operating system.


The following will have to be done on every machine that you would like
to have access to your localhost machine.

Add a line at the very end of your hosts file similar to this :

10.0.0.42       prathyash-localhost.com

The IP address (in the example above it is 10.0.0.42) is the address of your localhost; Your computers IP address. The domain name (prathyash-localhost.com) is what is mapped to the IP address.

After you save that file, whenever that computer points to prathyash-localhost.com, it will be directed to your IP address. Firewalls are still a barrier - however the other answers covered that so I will not repeat their contribution.


Depending on your situation, manually editing tens maybe hundreds of files might not be feasible. In this case, you might want to consult the networks administrator (he probably hangs around on Server Fault), and he may have a better solution for you.

这篇关于我怎样才能从其他计算机访问我的本地服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆