局域网访问PHP项目网站 用IP地址进入

先在apache中的 httpd.conf中将 Allow from 127.0.0.1 修改为Allow from all 如果你的是Allow from all的话就不需要改 然后再将

DocumentRoot "D:webphpstudyWWW" 这的文件路径换成PHP项目的路径。修改完成后也就是我这个样子。下图:

然后在 vhosts.conf 配置成 我这个样子的 如下图:

<VirtualHost 172.30.111.249>
        DirectoryIndex  index.html index.php
        ServerName  "172.30.111.249"
        DocumentRoot  "D:logispackagewebzczy"
</VirtualHost>

配置基本完成,还有最重要的一点就是重启apache服务,要不就白忙乎了。

重启apache后 在网址上输入你的局域网IP地址 如:172.30.111.249 就可以正常的使用了。

原文地址:https://www.cnblogs.com/wjm956/p/7447882.html