The requested URL / was not found on this server——Apache配置虚拟域名后无法访问localhost

时间:2022-04-01 21:07:43

  今天为了做项目,在Apache中配置了项目域名,成功访问。但是忽然发现要访问localhost突然出现The requested URL / was not found on this server.

  The requested URL / was not found on this server——Apache配置虚拟域名后无法访问localhost

  出现这种情况在网上查了下是由于开启 httpd.conf 文件中 Include conf/extra/httpd-vhosts.conf 导致的,只要把它注释掉就可以了,我试了一下确实可以,但是我的虚拟域名还得要啊。

  The requested URL / was not found on this server——Apache配置虚拟域名后无法访问localhost

  于是就想给 localhost 配置虚拟域名,但是配完之后也没有出现预期的效果还是访问不了。

  The requested URL / was not found on this server——Apache配置虚拟域名后无法访问localhost

  想了一下,localhost 在Apache配置中肯定配置了,不然装完Apache怎么就能访问我的www的根目录呢?所以就在 httpd.conf 的配置文件中找 localhost ,果然发现了 Apache 将其指向了 我的根目录,所以将其注释就可以访问了!

  The requested URL / was not found on this server——Apache配置虚拟域名后无法访问localhost