Table of Contents
Personal Homepage
This document describes how to setup a web site inside of your home directory which can be accessed at this URL: http://people.cs.uchicago.edu/~username
Step by step
1. Permissions on your home directory
Set your home directory to allow for at least execute permissions on group and other. This will enable the web server to execute the html files inside your home directory.
user@host:~$ ls -ld $HOME drwx------ 60 user group 4096 Dec 17 15:56 /home/user
user@host:~$ chmod 711 $HOME
user@host:~$ ls -ld $HOME drwx--x--x 60 user group 4096 Dec 17 15:56 /home/user
2. Creating the directory that will host your site
Our web server looks for a folder with the name of 'html' inside your home directory from which it will attempt to serve. If you do not already have this directory create it.
user@host:~$ mkdir -p $HOME/html
We want to make sure the web server has enough permissions to this directory.
user@host:~$ chmod 755 $HOME/html
Verify the change.
user@host:~$ ls -ld $HOME/html drwxr-xr-x 2 user group 53 Dec 17 15:57 /home/user/html
3. Creating your first web page
We can create a simple page by doing the following:
user@host:~$ echo 'hello world' > $HOME/html/index.html user@host:~$ chmod 644 $HOME/html/index.html user@host:~$ ls -l $HOME/html/index.html -rw-r--r-- 1 user group 28 Dec 17 15:57 /home/user/html/index.html
4. Viewing your home page
You can access your home page by using the following URL: https://people.cs.uchicago.edu/~username Please replace 'username' with your CNETID.
5. An additional note
PHP is supported on personal home pages.
Password protecting a directory
Please be aware that this not provide any real security and only keeps honest people honest. People viewing your page with a web browser will be required to provide a password. However, since files in your ~/html directory must be world readable to be seen by the server, anyone can view your html files directly.
Create new password file (with a user):
htpasswd -c .http_passwd new_user
- The password file should not be in your html directory, but it must be world readable.
- To add more users remove
-c
from the above command.
htpasswd .http_passwd user2
Put a file .htaccess in each html directory to be restricted. Start with this template:
AuthUserFile /home/mokwa/html/.http_passwd AuthName Projec AuthType Basic require valid-user
Now set the permissions on the .htaccess and .http_passwd file.
chmod 644 .htaccess .http_passwd