Sometimes users want to maintain their own web pages. You can configure public information directories that let all the users on a server create home pages and other documents without your intervention.
With this system, clients can access your server with a certain URL that the server recognizes as a public information directory. For example, suppose you choose the prefix ~ and the directory public_html. If a request comes in for http://www.sun.com/~jdoe/aboutjane.html, the server recognizes that ~jdoe refers to a users’ public information directory. It looks up jdoe in the system’s user database and finds Jane’s home directory. The server then looks at ~/jdoe/public_html/aboutjane.html.
To configure your server to use public directories, follow these steps:
From the virtual server page, click the Content Handling tab.
Click Document Directories.
Under User Document Directories, choose a user URL prefix.
The usual prefix is ~ because the tilde character is the standard UNIX/Linux prefix for accessing a user’s home directory.
Choose the subdirectory in the user’s home directory where the server looks for HTML files.
A typical directory is public_html.
Designate the password file.
The server needs to know where to look for a file that lists users on your system. The server uses this file to determine valid user names and to find their home directories. If you use the system password file for this purpose, the server uses standard library calls to look up users. Alternatively, you can create another user file to look up users. You can specify that user file with an absolute path.
Each line in the file should have this structure (the elements in the /etc/passwd file that aren’t needed are indicated with *):
Choose whether to load the password database at startup.
For more information, see the online help for the User Document Directories page.
Another way to give users separate directories is to create a URL mapping to a central directory that all of your users can modify.
In some situations a system administrator may want to restrict what user accounts are able to publish content via user document directories. To restrict a user’s publishing, add a trailing slash to the user’s home directory path in the /etc/passwd file:
After you make this modification, Web Server will not serve pages from this user’s directory. The browser requesting the URI receives a “404 File Not Found” error and a 404 error will be logged to the web server access log. No error will be logged to the errors log.
If, at a later time, you decide to allow this user to publish content, remove the trailing slash from the /etc/passwd entry, then restart the web server.
You also have the option of loading the entire password file on startup. If you choose this option, the server loads the password file into memory when it starts, making user lookups much faster. If you have a very large password file, however, this option can use too much memory.