Syntax error on line 293 of /etc/httpd/conf/httpd.conf: DocumentRoot must be a directory

Info.Tech, Linux System Administration Add comments

Fixing the error

Syntax error on line 293 of /etc/httpd/conf/httpd.conf: DocumentRoot must be a directory

I already encounter this problem few years back yet I forgot the solution. As you know, its a basic thing to do that we will set users home and its directories right? And I’m done with it. yet the error keeps coming when restarting Apache.

[root@localhost ~]# service httpd restart
Stopping httpd:                                            [FAILED]
Starting httpd: Syntax error on line 293 of /etc/httpd/conf/httpd.conf:
DocumentRoot must be a directory
                                                           [FAILED]

This is actually the SELINUX causing this error. After you change the following;

[root@localhost home]# chmod 711 user
[root@localhost home]# chmod 755 user/public_html

You should disabled your SELINUX.

In CentOS 5.2, you can simply type “setup“, go to Firewall Configuration and select SELinux: Disabled

But in CentOS 6.2, you can’t find it at “setup”, edit the file /etc/selinux/config and change the following from:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

to

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

Then reboot your machine/box!

That’s it! It should be working fine… You can use paths in users home. 🙂

  • Peter

    thank you for quick solution.

  • yann

    you saved my day, thanks !

  • Joule

    really helpfull

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in