Show Me
 

Configuring User Directories in Apache

Previous previous|next Next Page

Sheila's PHP development team requires a nonroot user environment in which to develop the PHP code. To enable the developers to store PHP code in their owner user directories, Sheila edits the Apache Web Server configuration file /etc/httpd/conf/httpd.conf and sets the UserDir directive.

To enable user directories in the httpd.conf configuration file, Sheila must perform the following changes to the file:

Comment out the line UserDir "disable"
Uncomment the line UserDir public_html

After the changes have been made, Sheila must restart the Apache Web Server by using the following command:

$ apachectl restart

Each developer must create a public_html subdirectory in their $HOME directory. The PHP and HTML files for the application are stored in the public_html directory to be accessible from a browser.

As a browser user, the initial part of the URL entered would be:

http://host/~user/target.html

Here, user is replaced with a registered operating system username.

Watch Sheila configure user directories and restart Apache as the root user. As a nonroot user, Sheila creates the public_html subdirectory and a default index.html file, and uses a browser to access the index.html file.

Launch Demonstration

Show Me and Try It