美文网首页
phpstudy搭建本地域名

phpstudy搭建本地域名

作者: Yoyo_UoU | 来源:发表于2017-12-11 10:31 被阅读0次
  • 在找到你安装phpstudy的文件夹,找到下面的conf文件夹下的httpd.conf文件,进入编辑
    E:\xxx\phpstudy\Apache\conf\httpd.conf
    查找Virtual hosts


    image.png

    把 Include conf/extra/httpd-vhosts.conf 前面的注释取消掉
    查找Listen
    新增 Listen 81

  • httpd-vhosts.conf 下新增
<VirtualHost *:81>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "E:/ys/phpstudy/WWW/项目根目录"
    ServerName 你的域名
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
  • 重启phpstudy
    以 localhost:81 访问
    手机访问把 localhost 换成你的 ip 地址
    查看你的ip地址,进入cmd 输入 ipconfig

需要注意的是:conf文件下面也有一个vhosts.conf,但根据httpd.conf里面修改的目录是

image.png
extra目录下面的httpd-vhosts.conf,自己就犯了这个错

配置错误常见问题

  1. 很多人在取消 Include conf/extra/httpd-vhosts.conf 这条注释之后阿帕奇就停止工作了,原因很多,你可以根据错误报告来查询。
  • 首先打开cmd
  • 输入 D:\GJ\phpstudy\Apache\bin\httpd.exe 回车
    记得改你路径

  1. 在httpd.conf里查找 DocumentRoot


    image.png

    按照上图对比修改

在文件上做了修改都要重启phpstudy

相关文章

网友评论

      本文标题:phpstudy搭建本地域名

      本文链接:https://www.haomeiwen.com/subject/fulmixtx.html