1

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)

chinmayv
  • 25
  • 5

1 Answers1

0

Checkout https://httpd.apache.org/docs/2.0/mod/mod_userdir.html

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).

Anil
  • 116
  • 1
  • 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 06:09
  • You are welcome. – Anil Feb 23 '12 at 06: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 06:15