HomeApache Page 2 - Getting Started with Apache 2.0 Part III
Personalized Websites - Apache
In this third and final installment of our "Getting Started with Apache 2.0" series, you will learn how to configure the Apache server as a "proxy server" for your local network, how to make use of "URL Re-writing," and much more.
I've already shown you how to host several websites on a single instance of Apache using "Virtual Hosts." However, this mechanism can be tedious to maintain if a network administrator wishes to allow each user (on the network) to host his/her own website on the Web server. Fortunately, Apache is equipped with the "mod_userdir" module, which allows visitors to access user-specific web sites using a pre-defined syntax.
Consider the following scenario: you have a Web server that can be accessed by pointing a Web browser to "http://www.myfirm.com/". Now, you would like to provide each user in the office - say Tom, Dick and Harry - with their own custom web sites, accessible using the following URLs - "http://www.myfirm.com/~tom", "http://www.myfirm.com/~dick" and "http://www.myfirm.com/~harry" respectively.
No sweat - all you need to do is configure the "mod_userdir" module (compiled, by default) with the help of the "UserDir" directive. Take a look:
The above directive will translate every request to a user-specific directory to the appropriate location. For example, a request for the file "http://www.myfirm.com/~harry/photos/index.html" will result in an attempt to retrieve the file located at "/home/harry/www/photos/index.html", where "/home/harry/" is the default user folder for Harry.
If you're paranoid about security, you have the option of enabling this feature for specific users only. For example,what if you would like to only allow Dick and Harry to host their websites on the server while preventing access to all other user-specific websites (including that of Tom)? Just implement the following changes:
UserDir disabled UserDir enabled dick harry UserDir /home/*/www
For starters, the "disabled" keyword disables access to the "per-user" directory of all users. Subsequently, the "enabled" keyword allows you to list the users for whom you would like to enable this feature.
Note that there are several security concerns that you need to address if you enable this feature. Therefore, it would be wise to review the following tutorial (part of the official Apache documentation) before you proceed any further: http://httpd.apache.org/docs-2.0/howto/public_html.html.