Today, after modifying the DocumentRoot directory of the httpd. conf file and restarting the HTTPd service, an error is reported.
DocumentRoot must be a directory
. At first, I thought it was a problem with my own configuration. Then I checked it and confirmed that the configured DocumentRoot is a directory. Ah, I had to Baidu for a moment. Haha,
It seems that many people have encountered such errors. In summary, there are two possible causes for the DocumentRoot must be a directory error.
1. the DocumentRoot directory configuration contains Chinese Characters
If your DocumentRoot directory contains Chinese characters, change it to English first. Haha ...... If not, let's take a look.
2. SELinux's security policy is tricky.
This is because after the SELinux security policy is enabled, the system sets directories or files to various types,
For example, home_root_t and user_home_t. Some Apache processes do not have the permission to access the DocumentRoot you just set. For
The SELinux Security Policy of Apache processes only allows access
Httpd_sys_content_t directory or file. So you can change the policy type of the directory or file to httpd_sys_content_t. Modify the command as shown in Figure
Below:
Chcon-R-H-T httpd_sys_content_t/Data/Coderbolg/
You can use LS-Laz to check whether the Directory Policy type is successfully modified. If this step is completed, an error will be reported ...... You have to look down.
3. Disable SELinux
If you are suffering from SELinux, there is no way. Disable SELinux directly. The system's anxiety is always less important than the server's access right. Directly edit the SELinux configuration file.
Vim/Etc/Sysconfig/SELinux
Change the value of SELinux from enforcing to disabled. Save the disk and exit. This is a good deal. If not, restart the server.