温馨提示×

centos apache日志在哪存放

小樊
44
2026-10-06 02:12:25
栏目: 智能运维

在 CentOS 上,Apache(通常是 httpd)的日志默认存放在以下位置:

1. 默认日志目录

/var/log/httpd/

2. 常见日志文件

  • 访问日志(access log)
    /var/log/httpd/access_log
    
  • 错误日志(error log)
    /var/log/httpd/error_log
    

3. 如果你用了虚拟主机

日志可能在:

/var/log/httpd/域名-access_log
/var/log/httpd/域名-error_log

或在虚拟主机配置中自定义的路径。

4. 查看日志配置位置

你可以确认日志具体路径:

grep -R "ErrorLog" /etc/httpd/
grep -R "CustomLog" /etc/httpd/

5. 实时查看日志

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

如果你用的是 CentOS 8 + nginx 反向代理 或 Apache 从源码安装,路径可能会不同,我可以帮你具体查。

0 踩