
今天在联系Git命令,并把个人的项目上传到了码云上,上传之后,想再次运行下个人本地的项目看看,看完之后就想看下localhost,结果尴尬的一幕出现了,之前运行好好的localhost竟然不能使用了:
经过百度最终终于将问题解决:
特此记录下:
1.先打开httpd.conf文件,打开httpd-vhosts.conf
"Include conf/extra/httpd-vhosts.conf"的注释,启动服务时优先加载此文件.
2.在httpd-vhosts.conf文件中配置localhost的虚拟主机:
DocumentRoot "F:/PHP/environment/phpstudy/WWW" ServerName localhost
3.在host文件中添加域名:
127.0.0.1 localhost(最后发现不设置此项也可以生效)
问题依然在继续,最后我也很无奈,便给localhost也添加形式为www.localhosts.com的域名格式,最后竟然可以访问,但是localhost怎么都访问不了.
不过,我还没放弃,最终功夫不负有心人,我在另一个兄弟的博客上看到了相似的情况,博客地址为:https://www.cnblogs.com/superfat/p/5228347.html,只要把httpd.conf中的"#ServerName localhost:80"或者把"ServerName localhost"注释掉即可,localhost可以正常访问了!
推荐教程:phpStudy极速入门视频教程
Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!
étude php
Comment ouvrir le fichier php
Comment supprimer les premiers éléments d'un tableau en php
Que faire si la désérialisation php échoue
Comment connecter PHP à la base de données mssql
Comment connecter PHP à la base de données mssql
Comment télécharger du HTML
Comment résoudre les caractères tronqués en PHP