在 CentOS 系统中,Apache 的日志文件通常位于 /var/log/httpd/ 目录下。以下是一些常见的日志文件及其用途:
访问日志 (access log):
/var/log/httpd/access_log错误日志 (error log):
/var/log/httpd/error_log要查看这些日志文件,你可以使用 cat、tail 或 less 等命令。例如:
查看访问日志的最后几行:
tail -n 100 /var/log/httpd/access_log
查看错误日志的最后几行:
tail -n 100 /var/log/httpd/error_log
如果你需要实时查看日志文件的更新,可以使用 tail -f 命令:
实时查看访问日志:
tail -f /var/log/httpd/access_log
实时查看错误日志:
tail -f /var/log/httpd/error_log
请确保你有足够的权限来读取这些日志文件,通常需要 root 权限或使用 sudo 命令。