客户端如何访问与服务器连接到相同WLAN的php应用程序?

我已经设置:

<VirtualHost 127.0.0.1:9900> ServerAdmin webmaster@localhost DocumentRoot "c:/wamp/www" ServerName url.pews.info ErrorLog "logs/localhost-error.log" CustomLog "logs/localhost-access.log" common DirectoryIndex gauge.php </VirtualHost> 

当我尝试从服务器计算机上的浏览器访问url.pews.info ,一切正常。

但是,我尝试在我的iPhone的浏览器中inputurl.pews.info ,并且无法连接,尽pipe它连接到与服务器相同的WLAN。

这是为什么?

感谢您的时间。

亲切的问候,
马吕斯

您的虚拟主机绑定到127.0.0.1:9900 。 这使得它绑定到回送接口,而不是听外界的连接。 至less在Unix / Linux环境下,我认为在Windows中也是如此。

请将该地址*:9900your.ip.address.here:9900改为,然后重新启动Apache。 这应该使它工作。

您可能没有在networking上进行任何DNS设置,以允许其他设备将主机名(url.pews.info)parsing为IP地址。

我怀疑这是在服务器上的本地工作,因为它的主机名与您尝试访问的URL相同,所以它能够解决它,而其他设备不能。

根据您的networking设置以及这是用于内部还是外部使用,您可以在本地路由器,域控制器,其他DNS服务器甚至是托pipe域名的人员的外部DNS中添加DNS条目,尽pipe最后一个抛出一些额外的问题。

或者,您可以将ServerAlias指令添加到您的Apacheconfiguration并通过IP访问:


ServerAdmin webmaster@localhost
DocumentRoot "c:/wamp/www"
ServerName url.pews.info
ServerAlias 192.168.0.1
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
DirectoryIndex gauge.php

然后客户端可以连接到Web服务器的IP并获得页面。