首页 > 解决方案 > 如何从另一台设备访问在我的服务器上运行的 php 网页?

问题描述

我目前正在使用 MAMP 允许在浏览器中打开我的 php 文件。我可以通过将我的服务器 IP 地址放入 URL 中,例如http://172.26.10.189/test.php在我的服务器上本地打开这些文件。

但是,当我尝试从另一台设备访问此页面时,该页面不会加载。我尝试在我的服务器防火墙上添加入站规则以允许连接到端口 8080。我尝试使用Listen 172.26.10.189:8080. 我还尝试完全禁用我的防火墙以查看是否发生了任何事情,但我仍然无法从另一台设备加载我的网页。

有没有人有任何其他建议?或者知道我做错了什么?谢谢!

标签: phpapachewebservermamphttpd.conf

解决方案


你应该做4个步骤

step1“将两台设备连接到同一个网络”: You'll need to connect both devices to the same network. So make sure your mobile phone is connected to the same Wi-Fi network that your computer is using.

step2“查找您的计算机的IP地址”:

For Windows, you can find the IP address by visiting Control Panel. In the search box, search for "adapter". Click on View Network Connections. Select the active network connection and click View status of this connection. Click Details and the IP address should be found next to IPv4 Address.

For Mac, open the Network Utility. You can find this quickly with Spotlight by typing cmd + space and then start typing "Network". With Network Utility open, your IP address can be found next to the label IP Address.

step3“查找您的计算机的主机名”:

If you prefer, instead of using the IP address, you can use the hostname. This might be preferable so you don't have to keep looking up the IP address every time you change networks.

On Windows, click Start. Then right-click on Computer and select Properties. Then click the Computer Name tab.

On Mac, open System Preferences and click Sharing. Look for the text that reads: Computers on your local network can access your computer at: computer-name.local.

step4“打开手机浏览器,访问IP地址或主机名”:

Using your mobile browser, simply type the IP address or host name into the URL bar. Make sure to include any necessary ports or paths required to view your website.

抱歉英语不好


推荐阅读