我在 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
我究竟做错了什么?