温馨提示×

apache日志centos存哪里

小樊
36
2026-10-23 16:34:22
栏目: 智能运维

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

1. 默认日志目录

/var/log/httpd/

2. 常见日志文件

  • 访问日志(Access Log)
    /var/log/httpd/access_log
    
  • 错误日志(Error Log)
    /var/log/httpd/error_log
    

3. 虚拟主机日志

如果你配置了虚拟主机(VirtualHost),日志可能在:

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

4. 查看 Apache 配置确认位置

日志路径由 Apache 配置文件决定,可查看:

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

常见配置文件:

  • /etc/httpd/conf/httpd.conf
  • /etc/httpd/conf.d/*.conf

5. 如果使用的是 Apache(httpd)还是 Nginx?

  • CentOS 默认包名是 httpd
  • 日志目录就是 /var/log/httpd/
  • 如果是自己编译安装的 Apache,可能在:
    /usr/local/apache/logs/
    

如果你愿意,可以告诉我:

  • CentOS 版本(7 / 8 / Stream)
  • 是否用 yum 安装的 Apache

我可以帮你更精确地定位日志。

0 踩