Previous Section  < Day Day Up >  Next Section

Recipe 22.8. Giving Users Individual Web Directories

22.8.1 Problem

You want your users to have their own individual web directories that site visitors can access via www.domain.com/~user, because this is the quickest and simplest way to give users public web pages. You don't need to mess with DNS or virtual hosts; just set up the user's directory, and you're done.

22.8.2 Solution

Set up your user directories in /var/www/users, or wherever you store your site files. Give each user his own subdirectory (e.g., /var/www/users/peters). Stick a copy of any index.html file in /peters, for testing. Then make this entry in httpd.conf:

UserDir /var/www/users

Restart Apache, and try this in a web browser:

http://localhost/~peters/

You should see your test index page.

22.8.3 Discussion

Remember to set the permissions on each user's directory so that legitimate users can get in, and unauthorized users are kept out. Set ownership to the user and the user's personal group, mode 755, because web pages must be world-readable.

22.8.4 See Also

  • http://localhost/manual/howto/public_html.html

    Previous Section  < Day Day Up >  Next Section