温馨提示×

centos如何检查apache状态

小樊
35
2026-10-20 12:13:33
栏目: 智能运维

在 CentOS 中检查 Apache(通常服务名为 httpd)状态,常用方法如下:

1. 使用 systemctl(CentOS 7 及以上推荐)

systemctl status httpd

看到 active (running) 表示正在运行。

启动 / 停止 / 重启:

systemctl start httpd
systemctl stop httpd
systemctl restart httpd

2. 使用 service(CentOS 6 或兼容方式)

service httpd status

3. 查看进程

ps -ef | grep httpd

或

pgrep httpd

4. 查看端口监听(默认 80)

ss -lntp | grep :80

或

netstat -lntp | grep :80

5. 测试访问

curl http://localhost

或浏览器访问服务器 IP。

6. 查看日志

tail -f /var/log/httpd/error_log
tail -f /var/log/httpd/access_log

如果你告诉我 CentOS 具体版本(6 / 7 / 8 / Stream),我可以给你更精确的建议。

0 踩