Nevis Web Setup Guide

This is a guide on how to set up your web site at Nevis Labs. Enough information is provided to get you started.

Note that in addition to the "personal web site" approach described below, you can also use this wiki, if you need a shared web site or you just prefer the Wiki approach to website development. (You may notice that most of the Nevis computing web pages, including this one, were moved to the wiki.)

Setting up your account

You need an account on the Linux cluster in order to have a web site at Nevis. All of your web pages must be put within a specific sub-directory of your account. The name of that sub-directory must be WWW. If you don't already have such a directory, use the following command to create it:

mkdir -p ~/WWW 

The only files that viewers will be able to see in your area are those within the WWW directory or in any sub-directories of WWW that you create.

Creating your first web page

Web pages are created using a language called "HTML" (Hyper-Text Markup Language). There is a wealth of information available on-line to teach you HTML. The guide I most often is w3schools. (HTML can also be used in this wiki, instead of TWiki's text formatting rules.)

Anyone with experience with a document-design language such as LaTeX will have little trouble mastering HTML. In fact, you usually create your first HTML document the same way you create your first LaTeX document: copy someone else's and edit it. For your convenience, two sample files are provided. The first, template.html, is heavily commented and teaches some basic HTML syntax. The second, sample.html, shows the layout of a simple home page that was produced by editing template.html.

To copy these files into your own area, use the following commands:

cd ~/WWW
cp ~seligman/WWW/template.html .
cp ~seligman/WWW/sample.html .

Edit these files with your favorite text editor. Emacs has a special HTML mode that is invoked automatically when you edit any file that ends in ".html". If you type C-h m while editing an HTML file, you'll see a description of the special features of this mode. (On the Mac, I used the free version of BBedit.)

Viewing your web pages

You can use your favorite Web browser to examine the contents of your HTML files. For example, after you've copied template.html to your area, you can see how it looks by telling your browser to look at the URL:

https://www.nevis.columbia.edu/~jsmith/template.html

assuming that your login ID is jsmith. Note that you do not type in the directory name WWW -- the Nevis Web server supplies this automatically.

By default, if a Web browser accesses a directory at Nevis but is not supplied with a file name, it will look for a file named index.html. Once you've created the file that you plan to use for your home page, you should either rename it:

mv yourhomepage.html index.html

or link it:

ln -s yourhomepage.html index.html

If you do so, then you can omit the file name when you tell other people the URL of your home page:

https://www.nevis.columbia.edu/~jsmith/

If you're having problems creating or changing your web pages, check out the questions below.

Additional tips

The Nevis style

If you want your web page to be in the same style as the main Nevis web site, you have to do the following:

  • In the <head> section, insert the following line:
    <!--#include virtual="/nevis-head.ssi" -->

  • Right after the <body> tag, insert the following line:
    <!--#include virtual="/nevis-body-start.ssi" -->

  • Right before the </body> tag at the end of the file, insert the following line:
    <!--#include virtual="/nevis-body-end.ssi" -->

  • Make the file executable. For example, if your file is index.html, run the following command:
    chmod +x index.html

Note that there's no policy or requirement that your page be in the same style as the Nevis web site. Feel free to define your own styles, write your own server-side includes, or include your own Javascripts.

Other examples

The files template.html and sample.html are very basic (and somewhat facetious) examples of how to set up a home page. For other examples, look at the home pages of some the Nevis faculty, such as Bill Zajc. You can copy these files into your own directory with the commands like:
cp ~zajc/WWW/index.html ~/WWW/zajc.html

"Steal" ideas from other web pages

In general, you can view the HTML source statements for any Web page that you see anywhere on the Internet. If you select "Document Source" from your browser's "View" menu, you will get a window with a listing of the original HTML text that generated the Web page. You can examine the code for tips and tricks, and copy the text from the window into a text editor for your own Web pages.

However, not all web pages can be usefully viewed in this way. Many web pages are created using advanced Web server techniques, such as SSI, CGI programs, and Java. If a Web page is frame-based, you can view the HTML code that generated the frame itself, but you have to use "Frame Source" to view the HTML that generated the contents within the frame. Some Web pages were created with utilities (such as Microsoft's FrontPage) that don't format the HTML code so that it can be easily read by human beings.

Let the sysadmin know

After you've set up your web site, be sure to tell the webmaster to update the Nevis Directory with your URL.

Obfuscate e-mail addresses

It's a bad idea to include your e-mail address directly as part of your web site. There are automated programs that scan web sites looking for e-mail addresses to add to mailing lists for unsolicited advertising ("spam").

At Nevis, we have a partial solution to this problem. A typical way to include an e-mail address in HTML is:

Send e-mail to
<a href="mailto://jsmith@nevis.columbia.edu">jsmith@nevis.columbia.edu</a>
Instead, use this:
Send e-mail to
<a href="https://www.nevis.columbia.edu/cgi-bin/ewarn.pl?jsmith&nevis.columbia.edu">John Smith</a>
On your web page, this will look like: "Send e-mail to John Smith." If you click on this link, it will display a warning page stating that the e-mail address is not to be used for advertising. Also, your e-mail address is less likely to be picked up by an automated program.

man pages

Any Nevis man page can be displayed via the web browser. For example, to display the man page on the ls command, use:
<a href="https://www.nevis.columbia.edu/cgi-bin/man.sh?man=ls">ls</a>
This can be handy if you're writing a set of instructions to your students on how to do something in UNIX. Note that this only works for man pages that are available on the web server.

Problems and Questions

Edits have no effect

I've created a web page and viewed it with a browser. I made a change, then I look at it with the browser again -- but none of my changes have taken effect. Why?

The answer is the browser cache. To save time, Web browsers store copies of the most recently-accessed Web pages in a local disk cache. A new version of the same Web page is only reloaded when you explicitly tell the browser to do so. At the top of the browser window is button labeled "Reload". Click this button with the mouse, and the newest version of your Web page will be loaded.

Can't see a file

I created a .html file, but when I type in the URL, the Web browser tells me that the file isn't there or that I don't have permission to view it. What's wrong?

Here are the things you can check:

File permissions

Look at the permissions of the .html file by typing ls -l name.html. A Web browser cannot see the file if it does not have "read" permission for "other" users. For example (what you'd type is prefixed with #):
# ls -l *.html
-rw-------    1 jsmith   collab      5749 May 30 17:31 index.html
# chmod +r index.html
# ls -l *.html
-rw-r--r--    1 jsmith   collab      5749 May 30 17:31 index.html

The file index.html did not have read permission for all users, so the Web browser could not see it. Adding read permission to the file fixes the problem.

Directory permissions

A more subtle problem is when you put .html files in a sub-directory. For a Web browser to access files within a sub-directory, that directory must have "execute" permission for "other" users. For example:
# cd ~jsmith/WWW
# ls -l
drwxr--r--    7 jsmith   collab       512 May 22 17:33 descript
-rw-r--r--    1 jsmith   collab      5749 May 30 17:31 index.html
# cd descript
# ls -l
-rw-r--r--    1 jsmith   collab      5749 May 30 17:35 stuff.html

The URL for stuff.html would be https://www.nevis.columbia.edu/~jsmith/descript/stuff.html. In this situation, although the Web browser can display index.html and even display the contents of folder "descript", it will return an error when trying to access descript/stuff.html. This problem can be fixed as follows:

# cd ~/jsmith/WWW 
# chmod +x descript 
# ls -l
drwxr-xr-x    7 jsmith   collab       512 May 22 17:33 descript
-rw-r--r--    1 jsmith   collab      5749 May 30 17:31 index.html

Now the Web browser will be able to access the contents of the "descript" directory.

PHP and other scripting languages

I've created a php script for my web site, but it doesn't work. What's wrong?

In Sep-2005 the Nevis web server was hacked due to a user's php script that did not check its inputs carefully enough. Since then, the policy has been to prevent php scripts from running from any user's directory.

This policy also applies to any executable scripts in a user's web site, whether in PHP, Perl, Python, Ruby, Java, or any other form of CGI programming. When properly written, such scripts are secure and highly useful in providing dynamic web content. Unfortunately, there's no easy way for us to guarantee that all users will write secure scripts, and we've made the choice of security over user convenience.

You can still write Javascripts if you choose.

Password protection

How do I "password protect" a directory so that only people with a password can access the directory with a web browser?

The trick is to set up a .htaccess file in the directory that you wish to be protected and a .htpasswd file in some other directory. You can find instructions here.

It's possible that the htpasswd command is not available on your machine. If not, let me know and I'll install it. (It's normally not part of a Linux installation unless the machine is going to host a web server.)

Also, as you create your .htaccess file, bear in mind that your home directory is not in /home; it's your home directory as seen by the Linux cluster. Use the command:

# echo $HOME
on the Linux cluster to see this path.
Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r10 - 2020-06-05 - WilliamSeligman
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback