在 CentOS 系统中,Apache(通常是 httpd) 的日志文件默认位置如下:
Apache 主日志目录一般在:
/var/log/httpd/
常见日志文件包括:
/var/log/httpd/access_log
/var/log/httpd/error_log
CentOS 默认使用 httpd 而非 apache2:
# 查看 httpd 是否安装
rpm -qa | grep httpd
# 查看日志目录
ls -l /var/log/httpd/
如果你配置了虚拟主机(VirtualHost),日志路径可能在:
CustomLog /var/log/httpd/example.com-access_log combined
ErrorLog /var/log/httpd/example.com-error_log
/etc/httpd/conf/httpd.conf
/etc/httpd/conf.d/*.conf
grep -R "ErrorLog" /etc/httpd/
grep -R "CustomLog" /etc/httpd/
systemd,服务名是 httpdtail -f /var/log/httpd/error_log
如果你用的是 Apache 从源码安装 或 其他发行版(如 Ubuntu 的 apache2),路径会不同,可以告诉我你的安装方式。