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
After apache prompts DocumentRoot must be a directory problem and changes 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 www.2cto.com [root @ sl ~] #
The documentroot must be a directory error is frequently encountered when configuring the Apache service, and it has been a few hours since the first contact with Apache to find the cause of the error, which is generally due to selinux.SELinux
Later found that the original Apache is not configured Well, is the Apache Mod_authz_host module in the control role.
1. If vhosts is not enabled
Just modify httpd.conf
The default directory section is as follows, note the Red section, which
Solution:
Method One:
Change the directory or file's policy type to httpd_sys_content_t.# chcon-r-h-t httpd_sys_content_t/www/web/You can then use the Ls-laz command to view the policy type of the file directory.
Method Two:
Disable SELinuxLinux
Under Windows, Apache's configuration file is usually only one, which is httpd.conf. But when I installed Apache2 with the Apt-get install apache2 command on Ubuntu Linux, I found that its httpd.conf (located in the/etc/apache2 directory) was empty.
Solution:
Method One:
Change the directory or file's policy type to httpd_sys_content_t.# chcon-r-h-t httpd_sys_content_t/www/web/You can then use the Ls-laz command to view the policy type of the file directory.
Method Two:
Disable SELinuxLinux
One, Apache main configuration file CommentApache master configuration file:/etc/httpd/conf/httpd.confDefault site home directory:/var/www/html/Apache server configuration information is stored in the main configuration
One, Apache main configuration file CommentApache master configuration file:/etc/httpd/conf/httpd.confDefault site home directory:/var/www/html/Apache server configuration information is stored in the main configuration
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.