简体   繁体   中英

Apache: ip connection works but not localhost

Earlier today I successfully connected to my Apache server both via http:/localhost and IP address. 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).

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. Additionally, I verified this issue on both Chrome and Firefox (where I also tried clearing the cache).

Any suggestions regarding how to fix this would be greatly appreciated.

Here are the lines I referenced in my httpd.conf file (spliced together):

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. By updating the httpd.conf file to read "Listen 80" I resolved this issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM