Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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