Building Your Own Web for the World


Note: This document only applies to UBC Computer Science users.

Note: These instuctions will work for UBC CS undergraduate accounts, but you must substitute www.ugrad.cs.ubc.ca for wherever you see www.cs.ubc.ca.


No doubt you've traversed the Web to sites all over the world. You may even have created your own hypertext files for your personal use or for others to read. If so, you know full well that those files can't get out to most of the world. Now they can. Just remember that any such files made available will be read by the whole world.

Everyone in the world can read those files.

Obviously, you should be careful what you export.

Getting Started

Setting up your world-readable Web is simple enough. Create a sub-directory in your home directory called ``World''. Make sure it is world readable. You may have to change the permissions on your home directory a bit, too. Here's some commands which will do the job:

      mkdir ~/World
      chmod 755 ~/World
      chmod o+x ~

Now just dump your HTML files in your ~/World directory. Those files will appear on our WWW server as /spider/username. That is, for the login id ``fred'', ``~fred/World/mydogs.html'' will be accessible as ``http://www.cs.ubc.ca/spider/fred/mydogs.html''. That's it; all the rest is window dressing.

If you don't know what HTML is just skip to the end of this document and come back later.

Getting Clever

While everything you want to be accessible to the world must be in ``~/World'', that doesn't mean that you need to make copies of your existing files. Instead, you can put symbolic links in ``~/World'' to the files. There's only two restrictions. First, you can't export any files you don't own. Second, the files you link to must be available on our WWW server. The first restriction isn't so bad. Just convince the other owner to make their files accessible through ``~them/World'' and use a URL as your link instead of a symbolic link. The second restriction is easy to test. Log into www.cs.ubc.ca and see if you can find the files you need. If not, it may be possible to add them, see George Phillips for assistance.

Getting Really Clever

For local people there's two ways to access your ~/World files. They can use the local file system with something like ``file://localhost/home/you/World/afile.html'' or the server like the rest of the world with ``http://www.cs.ubc.ca/spider/you/afile.html''. You're best not to worry about ``file:'' access, but you can make both work through the use of relative HREFs. For example, if ``afile.html'' wants to link to ``somefile.html'' in the same directory, use ``HREF=somefile.html'' instead of ``HREF=http://www.cs.ubc.ca/spider/you/somefile.html'' and the link will work for both types of access.

Whether you want to be that clever is your business. It will save some typing. The really important point is that ``file:'' references will not work for the outside world and you won't easily notice since you're in the inside world.

Getting Insanely Clever

You can export more that just hypertext (HTML) files. You can make GIF images, JPEGs, MPEGs, PostScript and even plain text available. The server has a problem that may become your problem. It needs to know the type of the file being exported. Fortunately, it will look at the file and its .suffix and make a guess that will almost certainly be right. However, a wrong guess could screw things up for you. You'll quickly see that when you look at the page. There's not too much you can do except ask George for a workaround.

There is a .suffix you can add to a file name that is quite useful. It is ``.saveme'' and it tells the client requesting the file that it should not attempt any viewing of the file but instead should save it to disk. Try out the following HTML fragment with some image file and you'll get the idea. Put ``picture.gif'' someplace accessible and do a ``ln -s picture.gif picture.gif.saveme''.

  Here we have a <A HREF=picture.gif>picture of something</A>.
  You can have a <A HREF=picture.gif.saveme>copy for yourself</A>
  if you like.

There is a special short name for one of your possible pages: ``http://www.cs.ubc.ca/spider/username'' will try and open ``~username/World/home.html''. You can use that as the entry point to your personal Web which is a short and easy to remember as possible. You should be careful to use absolute links in that page because it has two names and relative links will fail.

Getting Help

Things should go pretty smoothly. I've tried to outline a few pitfalls in the previous text. You'll find that the server is not very helpful when an error occurs. Check to make sure the ~/World file is world-readable (in the UNIX sense) and that you own it and that it exists on the host www.cs.ubc.ca.

If you don't know about HTML already, it's easy to learn. There's a good primer on writing HTML on the Web along with a slew of more technical information. The lynx and Mosaic (xwww) browsers have a feature where they'll let you look at the HTML source of a document. In lynx, use the ``\'' key. In Mosaic, look for ``View Source'' under the ``File'' menu. A word of warning: while the browser may do display the document, the HTML may not be good, conforming HTML.

Other Server Hooks

Our WWW server has one more hook in it. Your userinfo page can be customized somewhat by putting HTML in your ~/.userinfo file. This is described fully in another document.
-- George Phillips