You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Apache服务已正常运行,但浏览器无法通过localhost/127.0.0.1访问的问题求助

Apache服务已正常运行,但浏览器无法通过localhost/127.0.0.1访问的问题求助

我已经安装了apache2包并让它运行起来了。当我尝试通过访问http://localhost和http://127.0.0.1来测试时,浏览器显示“ERR_CONNECTION_REFUSED”。运行sudo systemctl status apache2后,得到以下输出:

apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
    Drop-In: /run/systemd/system/service.d
             └─zzz-lxc-service.conf
     Active: active (running) since Sat 2024-03-30 12:27:41 WIB; 2h 27min ago
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 5521 (apache2)
      Tasks: 6 (limit: 3396)
     Memory: 14.0M
     CGroup: /system.slice/apache2.service
             ├─5521 /usr/sbin/apache2 -k start
             ├─5619 /usr/sbin/apache2 -k start
             ├─5620 /usr/sbin/apache2 -k start
             ├─5621 /usr/sbin/apache2 -k start
             ├─5622 /usr/sbin/apache2 -k start
             └─5623 /usr/sbin/apache2 -k start

Mar 30 12:27:41 penguin systemd[1]: Starting The Apache HTTP Server...
Mar 30 12:27:41 penguin apachectl[5520]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globall>
Mar 30 12:27:41 penguin systemd[1]: Started The Apache HTTP Server.
Mar 30 12:40:48 penguin systemd[1]: Reloading The Apache HTTP Server.
Mar 30 12:40:49 penguin systemd[1]: Reloaded The Apache HTTP Server.

我可以正常运行ping localhost,输出如下:

PING localhost(localhost (::1)) 56 data bytes
64 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.723 ms

也能运行ping 127.0.0.1,输出是:

PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.297 ms

我还尝试了curl http://localhost,它能正常显示index.html文件的内容。

我从来没有在Chrome本身或者Linux容器里设置过任何防火墙规则,ChromeOS本身会有防火墙吗?

不管怎样,根据我查到的资料,如果curl能正常工作,那浏览器也应该能访问才对。我到底哪里做错了?

备注:内容来源于stack exchange,提问作者NuhUh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.17 13:14:33