Customized User Directories
Some sites like to allow individual users to publish a directory of web pages on the server. For example, a university department might want to give each student a public area, or an ISP might make some web space available on one of its servers to customers that don't have a virtually hosted web server. In such cases, it is typical to use the tilde character (˜) plus a user's name as the virtual path of the user's web site:
http://www.cs.myuniversity.edu/˜ian http://members.mybigisp.com/˜ian
Tip
The notion of using ˜ to mean a user's home directory originated at the University of California Berkeley during the development of Berkeley Unix, when the C shell command interpreter was being developed in the late 1970s. This usage has been expanded in the web world to refer to a particular directory inside a user's home directory or more generally a particular user's web directory, typically a directory named public_html.
Tomcat gives you two ways to map this on a per-host basis, using a couple of special
Listener elements. The Listener's className attribute should be
org.apache.catalina.startup.UserConfig, and the
userClass attribute specifies one of several mapping
classes. If your system runs Unix and has a standard /etc/passwd file
that is readable by the account running Tomcat, and that file specifies users' home
directories, use the PasswdUserDatabase mapping
class:
<Listener className="org.apache.catalina.startup.UserConfig" directoryName="public_html" userClass="org.apache.catalina.startup.PasswdUserDatabase"/> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access