Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Each time I create a webfolder under /var/www apache throws a 403 error. I have to echo 0>/selinux/enforce or chmod 777 the folders.

Thanks Jean

share|improve this question

I assume you are trying to access your new directory when apache throws the 403 error and that existing files and directories are just fine. To fix access on your new directory, you may try :

  1. set owner and group to the apache user/group
  2. set selinux labels

1. owner and group

Look for the account used by the apache processus (it should be www-data) and execute this command :

mkdir /var/www/newdir
chown -Rh www-data.www-data /var/www/newdir

It will set owner and group for /var/www/newdir and its files and subdirectories without following symbolic links.

2. selinux labels

You have to set the correct label on the new directory. Run the following should help :

restorecon -Rv /var/www/newdir

It will restore the correct labels for /var/www/newdir and its subdirectories.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.