I keep getting this error when I restart httpd:

DocumentRoot does not exist

What else can I do besides disable editing /etc/sysconfig/selinux to fix it?

  • 1
    Which operating system and which version/distribution are you using? which httpd?
    – Nils
    Commented Dec 5, 2012 at 21:20
  • 1
    At least post your Apache configuration, and tell us what distribution you're running. Commented Dec 5, 2012 at 23:13

2 Answers 2


Open /etc/selinux/targeted/booleans file using a text editor:

# vi /etc/selinux/targeted/booleans

Append or modify value for httpd_disable_trans as follows:


Save and close the file. Type the following two commands:

# setsebool httpd_disable_trans 1
# /etc/init.d/httpd restart

PostInstallerF may help you

You can take help from the following resources

  • I can't find the file to edit, on CentOs I have /etc/selinux/mls/setrans.d/
    – freja
    Commented Dec 5, 2012 at 6:46
  • is it /etc/grub.conf ?
    – freja
    Commented Dec 5, 2012 at 6:55
  • I don't want to disable it because it is important security and although I am getting a warning in httpd I can still access pages so shouldn't I leave selinux alone?
    – freja
    Commented Dec 5, 2012 at 7:04
  • anyway sestatus -vi says command not found so don't know if it is installed
    – freja
    Commented Dec 5, 2012 at 7:09
  • @freja, check the resource dasourcerer.net/how-to-disable-selinux-for-apache-on-centos-6x Commented Dec 5, 2012 at 7:24

Don't disable SELinux. That's just asking for trouble.

As for solving the problem, I'm just going to quote myself here:

It appears you've created a new directory outside the standard filesystem hierarchy to hold your web documents.

When you do this, SELinux is not aware of your custom directory structure, and doesn't know that Apache (httpd) should have access to it. You will see messages in /var/log/audit/audit.log showing denials in this case.

To actually fix the problem, you need to tell SELinux that Apache can access the directory. Do this using the semanage fcontext command:

semanage fcontext -a -t httpd_sys_content_t "/volume1/web(/.*)?"

The pattern matching is done with regular expressions, so this will match /volume1/web and everything below it. The fact that it uses regular expressions also means you need to quote it as shown above.

Then relabel the files:

restorecon -r -v /volume1/web

SELinux will now permit Apache to access files in /volume1/web.

  • Michael, I have since got everything working but admittedly have forgotten about selinux so would you say this security is not working in the background regardless of no apache errors ?
    – freja
    Commented Dec 11, 2012 at 0:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .