简体   繁体   English

Apache:ip 连接有效,但 localhost 无效

[英]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.

相关问题 Apache Servicemix Windows-在Localhost中工作,但不能使用公共IP地址 - Apache Servicemix windows - Works in Localhost but not with the public IP address Apache:本地主机正常运行,服务器IP不可用(403:禁止) - Apache: localhost working, server IP not (403: forbiddden) 127.0.0.1在apache2服务器上有效,但localhost无效 - 127.0.0.1 works, localhost not, on apache2 server 除了Apache“ It Works!”以外,无法查看XAMPP本地主机页面。 - Can't view XAMPP localhost Page except Apache “It Works!” 通过 https://localhost:8000/ 访问时,Localhost 拒绝在 WSL2 上连接,但在使用内部 WSL IP 地址时有效 - Localhost refused to connect on WSL2 when accessed via https://localhost:8000/ but works when using internal WSL IP adress 使用端口将Localhost更改为ip - Change Localhost to ip with port Windows localhost和virtualhosts上的Apache - Apache on Windows localhost and virtualhosts localhost的getCanonicalHostName适用于Win 7但不适用于XP吗? - getCanonicalHostName for localhost works on Win 7 but not XP? 丢失本地主机网络连接的机会? - Chance of losing a localhost network connection? MOPED:无法为以下地址解析IP:localhost:27017(导轨) - MOPED: Could not resolve IP for: localhost:27017 (rails)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM