Tag Archives: DocumentRoot must be a directory

[Solved] Apache Warning: DocumentRoot must be a directory

After changing the DocumentRoot to /home/test/www it prompts.
Starting httpd: Syntax error on line 293 of /etc/httpd/conf/httpd.conf:
DocumentRoot must be a directory

[root@sl ~]# getsebool -a |grep httpd_enable_homedirs
httpd_enable_homedirs –> off
It turns out that SELinux does not allow home directories to be used as web directories

Modify SELinux settings
[root@sl ~]# setsebool httpd_enable_homedirs on

After restarting apache, everything is fine
[root@sl ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]