1、先打开httpd.conf文件,打开httpd-vhosts.conf include conf/extra/httpd-vhosts.conf的注释,启动服务时优先加载此文件.
2、在httpd-vhosts.conf文件中配置localhost的虚拟主机:
<virtualhost *:80> documentroot "f:/php/environment/phpstudy/www" servername localhost</virtualhost>
3、在host文件中添加域名:
127.0.0.1 localhost
4、把httpd.conf中的#servername localhost:80或者把servername localhost注释掉即可,localhost可以正常访问了!
推荐教程:phpstudy使用教程
以上就是phpstudy打不开localhost的详细内容。