apache提示DocumentRoot must be a directory的问题
 
将DocumentRoot改为/opt/www后提示:
Starting httpd: Syntax error on line 293 of /etc/httpd/conf/httpd.conf:
DocumentRoot must be a directory

百度一圈都说是修改目标文件夹的context值,chcon -R -h -t httpd_sys_content_t  /opt/www
实际上还有另外一个限制,如下:
原来是SELinux不允许使用home目录作为web目录 
[root@sl ~]# getsebool -a |grep httpd_enable_homedirs
httpd_enable_homedirs --> off

 
修改SELinux设定
[root@sl ~]# setsebool httpd_enable_homedirs on