![权限被拒绝:AH00649:无法打开传输日志文件](https://linux22.com/image/697382/%E6%9D%83%E9%99%90%E8%A2%AB%E6%8B%92%E7%BB%9D%EF%BC%9AAH00649%EF%BC%9A%E6%97%A0%E6%B3%95%E6%89%93%E5%BC%80%E4%BC%A0%E8%BE%93%E6%97%A5%E5%BF%97%E6%96%87%E4%BB%B6.png)
我在 Google Compute 上设置了新的 CentOS 7 + Apache 2.4 服务器,但在配置和运行虚拟主机时遇到了一些问题。我之前使用的是 CentOS 6 + 2.2 Apache 服务器。
下面这CustomLog
行代码是导致 Apache 抛出错误并拒绝启动的原因。换句话说,如果我注释掉那行代码,Apache 可以正常启动并提供我的DocumentRoot
.
<VirtualHost *:80>
ServerName bethesparkle.com
ServerAlias www.bethesparkle.com
<Directory /var/www/users/kenny/domains/bethesparkle.com/html>
Options Indexes FollowSymLinks MultiViews ExecCGI Includes
AllowOverride All
</Directory>
DocumentRoot /var/www/users/kenny/domains/bethesparkle.com/html
CustomLog /var/www/users/kenny/domains/bethesparkle.com/logs/access.log combined
</VirtualHost>
当我尝试启动 Apache 时,错误日志中显示的内容如下:
[log_config:error] [pid 27405] (13)Permission denied: AH00649: could not open transfer log file /var/www/users/kenny/domains/bethesparkle.com/logs/access.log.
AH00015: Unable to open logs
ls -Zd
我已经使用 Linux 和 Unix 多年了,但我对 SELinux 还不熟悉,仅供参考。以下是每个目录(直至日志目录)的输出:
drwxr-xr-x. root root system_u:object_r:var_t:s0 /var
drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 /var/www
drwxr-xr-x. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 /var/www/users
drwxr-xr-x. kenny apache unconfined_u:object_r:httpd_sys_content_t:s0 /var/www/users/kenny
drwxr-xr-x. kenny apache unconfined_u:object_r:httpd_sys_content_t:s0 /var/www/users/kenny/domains
drwxr-xr-x. kenny apache unconfined_u:object_r:httpd_sys_content_t:s0 /var/www/users/kenny/domains/bethesparkle.com
drwxrwxr-x. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 /var/www/users/kenny/domains/bethesparkle.com/logs
我究竟做错了什么?