[英]Apache: ip connection works but not localhost
Earlier today I successfully connected to my Apache server both via http:/localhost and IP address.今天早些时候,我通过 http:/localhost 和 IP 地址成功连接到我的 Apache 服务器。 I turned off the server briefly and when I ran it again, I was only able to connect via IP (which connects successfully from my computer as well as others in the network).
我短暂关闭了服务器,当我再次运行它时,我只能通过 IP 连接(从我的计算机以及网络中的其他计算机成功连接)。
I checked to make sure that my ServerRoot and DocumentRoot were C:/Apache24 and ${SRVROOT}/htdocs respectively as well as that all my server-related files were in htdocs.我检查以确保我的 ServerRoot 和 DocumentRoot 分别是 C:/Apache24 和 ${SRVROOT}/htdocs 以及我所有与服务器相关的文件都在 htdocs 中。 Additionally, I verified this issue on both Chrome and Firefox (where I also tried clearing the cache).
此外,我在 Chrome 和 Firefox 上都验证了这个问题(我也尝试清除缓存)。
Any suggestions regarding how to fix this would be greatly appreciated.任何有关如何解决此问题的建议将不胜感激。
Here are the lines I referenced in my httpd.conf file (spliced together):这是我在 httpd.conf 文件中引用的行(拼接在一起):
Define SRVROOT "C:/Apache24"
ServerRoot "${SRVROOT}"
DocumentRoot "${SRVROOT}/htdocs"
<Directory "${SRVROOT}/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
I would be happy to elaborate on any pertinent information I may have neglected我很乐意详细说明我可能忽略的任何相关信息
By setting the "Listen" setting to a specific IP address and port as opposed to a port, I stopped my computer from accessing the site via localhost.通过将“侦听”设置设置为特定的 IP 地址和端口而不是端口,我阻止了我的计算机通过 localhost 访问该站点。 By updating the httpd.conf file to read "Listen 80" I resolved this issue.
通过将 httpd.conf 文件更新为“Listen 80”,我解决了这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.