Creating a Homepage -- a Document for Users

This document is for the ordinary user, not the system "webmaster". It is intended as a short description of how to set up your home page (and related documents if you wish). It is not a primer on writing HTML, there are many of those -- some are listed below. Instead it deals with what to do with a homepage document after it is created to put it "on the Web."

If you have not created a home page here is a bare bones one you can copy to expand on later:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
<title>John Doe's Homepage</title>
</head>

<body>

<h1>John Doe's Homepage</h1>

This is the story of my life and manifold accomplishments...

</body>
[Note: To find out more about composing HTML documents consult A Beginner's Guide to HTML (at http://www.ncsa.uiuc.edu/General/Internet/WWW/HTMLPrimer.html) or see Creating Net Sites (at http://home.netscape.com/home/how-to-create-web-services.html).]

Your home page and any other files you want to serve must be located in a particular subdirectory of your home directory (your home directory is where you are when you first login) on the system which is running the web server. Usually this subdirectory is called public_html.

Note: Some users on our system have two accounts: a "public" account on our home server (accessible from any or our public machines), and a "private" account on the machine placed in their office. Your web directory must be a subdirectory of your "public" home directory. If you login to your public account on any of our public machines you will be automatically in your public home directory. But if you login to your private account on a private machine, then before following the instructions below you need to change directory to your "public" home directory, which on your private machine can be seen as /rhome/username/, where "username" is your user name. For instance if your username is jdoe, then your public home directory will be /rhome/jdoe/, and you can move there by typing the following command:

cd /rhome/jdoe/

Now you can create your web home directory with the command

mkdir public_html

The public_html directory also must have the correct "permissions" so that the server can look inside it. For security reasons the web server is not very powerful and it can only access files and directories which are not heavily protected. Just to make sure the server will not have trouble accessing your homepage run the command

chmod 755 public_html

You must place a copy of your homepage in this directory and give it the name index.html. One way to do this is enter the public_html directory and use an editor to create the homepage file there with the name index.html. Alternatively, you could create it elsewhere and copy it to the public_html directory. If you need to rename it the proper UNIX command is "mv oldname newname".

Of course the server must also be able to read your homepage in order to serve it. If documents you create are automatically protected from viewing by others you will have to change that for your homepage. The command

chmod 644 index.html
gives anyone (including the server) permission to read but not change your homepage.

What is your URL?

So once your homepage is functional, how do you access it? Well, your webpage address (called a URL which stands for "Uniform Resource Locator") is made up from the name of your host and your user name. For example, if your user name is jdoe and the computer on which the server is running is named www.math.northwestern.edu then the URL for your homepage is
http://www.math.northwestern.edu/~jdoe/
There are a couple of things to notice about your URL.

First it has a synonym

http://www.math.northwestern.edu/~jdoe/index.html
This is because whenever a URL ends in '/' the server knows it is referring to a directory (in this case your public_html directory) and looks for the default file "index.html" in that directory. Thus if you want to put some files in subdirectories of public_html that is fine. But keep in mind that if you create the directory "mydir" in public_html then http://www.math.northwestern.edu/~jdoe/mydir/ will really refer to http://www.math.northwestern.edu/~jdoe/mydir/index.html and to refer to a file "foo.gif" in mydir you should use http://www.math.northwestern.edu/~jdoe/mydir/foo.gif. You should not use the URL http://www.math.northwestern.edu/~jdoe/mydir referring to a directory but with no '/' at the end.

Advanced Features

There are many advanced features you can use with the apache server. To learn to use them you will need to read the manual.