要检查 apache 是否运行,linux 用 systemctl status apache2 或 httpd,windows 查看服务状态,macos 用 brew services list;apache 默认监听 80 端口;如需修改端口,1. 找到配置文件路径,linux 是 /etc/apache2/ports.conf 或 /etc/httpd/conf/httpd.conf,windows 在安装目录 conf/httpd.conf,macos 为 /usr/local/etc/httpd/httpd.conf;2. 将 listen 80 改为新端口,并更新虚拟主机配置中的端口号;3. 保存后重启 apache 服务使更改生效;注意权限、端口冲突及防火墙限制。

Apache 是常用的 Web 服务器软件,很多网站和本地开发环境都依赖它运行。如果你在使用 Apache,可能会遇到服务没启动、访问不了页面或者想改默认端口的情况。下面我们就来看看怎么检查 Apache 是否正常运行,以及如何修改它的默认端口。
查看 Apache 是否正在运行
检查 Apache 状态的方法主要取决于你用的是哪种系统。
