Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I am using httpd server on CentOS (with SELinux enabled). I want to use UserDir (public_html)

If I create the user on local system it works but when I give the path on NFS shared system it gives 404 error.

I am using this directive: <Directory /nfs/*/*/public_html>

If I try to access http://domain/~user In error logs of httpd it says /var/www/html/~user not found. Somehow it is not going to path /nfs/students/user/public_html. What's the solution for this?

I have set the boolean with setsebool -P httpd_allow_nfs on and nfs is mounted with options defaults,nosuid,nodev (can I add noexec to it)

share|improve this question
What, EXACTLY, does the error log say. – adaptr Feb 22 '12 at 11:34
up vote 0 down vote accepted


The UserDir directive is used to tell apache how to transform those http://domain/~user requests to local path.

Search for the UserDir setting in your apache configuration and set it to:

UserDir /nfs/students/*/public_html

or append the new pattern (UserDir accepts multiple patterns).

share|improve this answer
Thanks that solved it :) But now error is 403. Do I have to do anything other than setting httpd_allow_nfs to blue ? – chinmayv Feb 23 '12 at 6:09
You are welcome. – Anil Feb 23 '12 at 6:10
403 should be related to permissions to access the folder (most likely). The 'user' folders should be readable by user your apache server is running as (www-data, www, web or apache some user id like that). Find the user id, switch to user (using su to switch to root first, then su www-data to switch to the apache user. The try visiting your /nfs/students/*/public_html, if you are unable to read files, apache wont be able to read either. Then you'd have to fix the permissions to the directory. – Anil Feb 23 '12 at 6:15
Thanks for solution. Sorry for late reply – chinmayv Mar 9 '12 at 5:58

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.