[NMIA Logo]
Support
 
Home
|
NMIA's services
|
Manage Your Account
|
Support
|
Message of the Day
|
Check email via the web

Creating your NMIA website

Your NMIA full account has webspace provided at the address of http://www.nmia.com/~(USERNAME). In your home directory there is a folder called public_html that is accessible with your username and password via FTP. SSH access is available on request. Please send an email request to help@nmia.com if you wish to enable SSH access for your account. To learn more, click on the appropriate links below.
You may print this entire page to keep as a reference or read while off line.

Page Index

HTML help for the novice user

1.1 Create an image map - Create an image on your website where different areas are clickable for different events!

HTMLGoodies - Great for beginners who want to learn HTML. Free tutorials start you right from the beginning and assume nothing.

NCSA Beginner's Guide to HTML - Another good tutorial.

FTP, SFTP, SSH and changing passwords
2.1 FTP - File Transfer Protocol is the Internet standard for moving files from one computer on the Internet to another. You can use it to send your webpages to our server so anyone in the world can see it.

2.2 SSH - SSH clients are programs that "log in" to another computer, such as our server. When "logged in" it is as though you are sitting right at our server. You can move your files around, edit your webpages and run programs. SSH access is disabled by default on user accounts. If you would like SSH access enabled, just email your request to help@nmia.com

2.3 SFTP - Secure File Transfer Protocol is the new way of transferring files, that protects your password, and all other data with the use of encryption. Like ftp, you can use it to send your webpages to our server so anyone in the world can see it.

2.4 Unix Commands - Here is a list of commands you may use when you SSH into the server.

2.5 BASH Commands - BASH is the default shell when you log into NMIA via SSH.

2.6 vi - A text editor of sorts in Unix.

2.7 Passwords - Changing your shell password.

Counters, CGI, forms and access control on NMIA
3.1 CGI on NMIA - Common Gateway Interface, or CGI, is what the Internet uses to enable people to send information back to the website they are on.

3.2 Make a counter on your page - Use the counter that NMIA already has in place to keep track of visits to your page.

3.3 Using forms on NMIA - Use forms to get information from your web visitors.

3.4 Using NMIA's form mail - For NMIA users only! - Use our Formmail program to send yourself an email everytime someone fills out your web page form.

3.5 Controlling Access to your pages - Is something on your site that you only want certain people to see? Set up usernames and passwords.

3.6 PHP - PHP Hypertext Preprocessing. This is a preprocessor for HTML that advanced users utilize. Not for the beginner webdesigner.

Publicizing your page and other fun stuff
4.1 Let the world know about you! - Submit your site to search engines for more traffic.

4.2 Usenet Newsgroups - Here are some helpful groups for common web type questions.

4.3 Instructions for tracking Web page accesses - How to get your apache log files.


HTML help for the novice user.

1.1 Imagemaps on NMIA

Any documentation or imagemap creation programs that you find on the net are likely to apply to imagemaps on NMIA.

In order to serve an imagemap, a user foo would use the following in an html file:

<A HREF="/~foo/foos.map"> <IMG SRC="foos.gif" ALT="Map" ISMAP></A> Note that it is assumed that the above link is in a file served by NMIA's http server that is in the same directory as foos.gif.

The HREF tells the server that the map file that it should use is ~foo/public_html/foos.map. There's nothing special about the root of the users public_html directory. The user foo could have put the map file in ~foo/public_html/bar/foos.map and used `~foo/bar/foos.map' for the second part of the HREF.

The SRC is just the location of the image. In the above example, the image is in the same directory as the file containing the example link. It's just another URL.

The file `foos.map' is called a map file. The format is very simple, and is described in NCSA's Graphical Information Map Tutorial. If you read the tutorial, ignore references to `conf/imagemap.conf'. They refer to a bit of configuration that is not necessary on NMIA.

Back to HTML help for the novice user.

FTP, SSH and Changing passwords.

2.1 FTP
FTP stands for File Transfer Protocol. It's an Internet standard for transferring files. There are many programs that use the FTP protocol to transfer files. Here are instructions for using the most common programs:

2.1.1 WS_FTP (for Windows)

2.1.2 ftp (Command-line)

2.1.3 FTP Transfer Modes

2.1.4 Fetch for Macs

FTP is just a protocol. Many different clients can implement FTP (or parts of it) providing any number of interfaces to FTP. If you have Windows 95 and would like to try a different ftp client, take a look at the winfiles.com FTP clients page. There are so many clients out there, that we can't know them all intimately. If you need a lot of support, we suggest that you stay with the 32 bit version of WS_FTP.

Back to FTP and SSH.

2.1.1 Using WS_FTP

When you first start up WS_FTP, you're presented with the Session Profile dialog box. If your version of WS_FTP was pre-configured by NMIA, you have a profile named `My Account' which you can use to connect to NMIA.

If your copy was not pre-configured by NMIA, you'll probably want to create a profile for your account. To do this:

  • click on new
  • use something appropriate for the Profile Name (e.g., `My Account' or `My Web Page')
  • use ftp.nmia.com as the Host Name
  • use your username as the User ID
  • optionally, type your password in the Password field and check Save Password
  • make sure that Anonymous Login is NOT checked
  • use ~ or ~/public_html as the Remote Host Initial Directory
  • use whatever local directory you'd like as the Local PC Initial Directory.
  • click on Save
  • Note that you can create as many Session Profiles pointing at one site as you'd like. You could, for example, have one for transferring your home page stuff (set up so that the local and remote directories are convenient) and another one for downloading random stuff to a temporary directory.

    Once you've selected the appropriate Session Profile, click on OK and WS_FTP will automatically `log you in' to the host given in the profile.

    Once you're logged in, you'll see a representation of your local filesystem on the left and a representation of the remote filesystem on the right. Each side has directories on top and files on bottom. You can change directories by double clicking on them. You can transfer files by double clicking on them or by single clicking and then clicking on the arrows.

    Before you transfer and files, make sure that you understand the idea of transfer modes.

    Back to the top of FTP.

    2.1.2 Using a Command-line FTP Client

    Command-line ftp clients all function the same, once you're in them.
    Windows 95 and higher has a very nice FTP client built in. To use it, open up a DOS window and go (using the cd command) to the directory containing the files that you want to upload or to a directory to which you'd like to download files.

    Once you're in the right directory in your DOS window, start up your FTP client with the command:

            ftp
    
    which will give you a prompt that looks like:
            ftp>
    
    Now type:
            ftp>open servername
    
    Once you enter the above command, you'll be prompted for a username. If you're ftp'ing to your account on NMIA, enter your NMIA username. If you're connecting to a site that you don't have an account on, use the username "anonymous". Next you'll be asked for a password. If you're ftp'ing to your account on NMIA, use your shell account password. If you used the username "anonymous", use your email address as the password.

    If you entered a valid username and password pair, you should see something similar to:

            220 User username is logged in.
            ftp>
    
    If you still only see
            ftp>
    
    Then you aren't connected. Try the "open servername" command again. At this prompt, you can enter many different commands. Here is a summary of some of the most useful:
    put local remote
    This transfers the file named local from your local machine to the remote machine and names it remote on the remote machine. The second argument, remote is optional. If you omit it, the name of the file on the remote machine is the same as the name on the local machine.
    mput file1 file2 file3 ...
    This transfers the named files from your local machine to the remote machine. Wildcards (e.g., *.TXT) are allowed (and even useful).
    get remote local
    Like put, but you're getting a file instead of putting it. This time, local is optional.
    mget file1 file2 file3 ...
    Like mput, but downloads the named remote files.
    rename old new
    This command renames the remote file named old to new.
    ascii
    Sets the transfer mode to ascii.
    binary
    Sets the transfer mode to binary.
    lcommand
    Typing an "l" (el) as the first character of a command interprets the following command as a local command. (note: If you're using a unix ftp command-line client, use a bang "!" in place of "l".)
    i.e.:
    ftp>ldir
    would list all the files in the current directory of your local machine.
    Even more useful is to change current directory on the local machine:
    i.e.:
    ftp>lcd /this/folder

    There are many other commands, some of them are even useful. You can see a list by entering the command help.

    You should read about transfer modes before you do a lot of ftp'ing. I know that it doesn't sound too important, but it may save you some time.

    Back to FTP.

    2.1.3 FTP Transfer Modes

    There are two ways of transferring files: ASCII and BINARY.

    Binary Transfer Mode

    When a file is transferred as BINARY, it is copied bit for bit from one machine to the other. Both files (the original and the transferred file) will consist of exactly the same sequence of bytes.

    ASCII Transfer Mode

    When a file is transferred as ASCII, it may be changed slightly to maintain the meaning of EOL (End Of Line) characters.

    Why two modes?

    There are two common ways of ending a line in an ascii text file. Unix systems mark the end of a line with a single character, a linefeed (newline; NL or LF; ascii 10 in decimal). DOS marks the end of a line with a pair a characters a carriage return (CR; ascii 13 in decimal) followed by a linefeed.

    In order to transfer files and preserve the meaning of these ends of lines, the end of line characters have to be changed. When going from DOS to Unix, CR/LF pairs have to be transformed to a single LF. Similarly, when going from Unix to DOS, LF's have to be replaced with CR/LF pairs. That's the only difference between the two transfer modes.

    If you transfer a text file from DOS to Unix as a binary file, it will have carriage returns (often seen as ^M) on the end of each line. In a Unix text file, carriage returns are just like any other character (except that they're usually invisible).

    If you transfer a text file from Unix to DOS as a binary, you'll see a staircase effect when you print it out. That's because DOS just sends files to printers directly and carriage returns and newlines are taken literally (think about old printers; linefeeds advance the paper and carriage returns move the printing mechanism to the far left). You'll also see the staircase effect if you type the file.

    Choosing a mode

    In general images and programs are binary and web pages are ascii text. Note that perl scripts are ascii text.


    Back to the top of FTP.

    2.2 SSH

    SSH is a service that allows one to make an encrypted TCP connection to a remote machine. To make use of ssh, one must have a program (called a "secure shell client") that uses the secure shell service to connect to a program running on a remote machine (the "secure shell server"). For security reasons, SSH access is disabled by default on user accounts. Please email us at help@nmia.com if you wish to use SSH.

    To connect to NMIA via SSH, use plato.nmia.com for the hostname, and don't forget to specify 'ssh' as the connection type.
    You will have to enter your login password when first using an ssh client. Note, if your username begins with a capital 'P', leave it out while making an SSH connection. To learn more about ssh, visit either of these sites:
    General Background
    Official SSH Home Page

    If you don't have an ssh client already, putty is a pretty good one and many others for various operating systems are listed below.

    MIT's Putty
    Putty is a free-source ssh client created at MIT that can be downloaded from us here, as well.
    Windows 95, NT, 98, ME, XP; Freeware.
    VanDyke Software, Inc.'s SecureCRT
    Windows 2003, XP, 2000
    Sassy Software's Better Telnet
    Macintosh; Freeware.
    SshCE
    Windows CE; Shareware.
    NiftyTelnet SSH
    Macintosh; Freeware.
    AT&T Labs' U/WIN
    Windows 95/98/NT; Free for educational, research, and evaluation purposes.
    GNU MacSSH
    Macintosh OS 7.5.1 and higher; Freeware distributed under the GPL.
    GNU SSHDOS
    Dos; Freeware distributed under the GPL.

    Back to FTP and SSH.

    2.3 SFTP

    SFTP is a hybrid of SSH and FTP, which provides the ability to make an encrypted TCP connection and securely transfer files over a network. To make use of sftp, one must have a program (called a "secure ftp client") that uses the secure ftp service to connect to a program running on a remote machine (the "secure ftp server").

    To connect to NMIA via SFTP, use sftp.nmia.com or home.nmia.com for the hostname. You will have to enter your login password when first using an sftp client. Note, if your username begins with a capital 'P', leave it out while making an sftp connection. To learn more about sftp, visit the official SSH homepage.

    Here are some SFTP clients available for download:

    PSFTP
    Putty secure FTP.
    Windows 9x, ME, NT, 2K, XP; Command-line; Freeware distributed by MIT.
    Here is a list of ftp commands that you'll need to know if you plan on using Putty.
    WinSCP
    Windows Secure Copy utilizes some of the Putty 0.51 source code.
    Windows 9x, ME, NT, 2K, XP; Fully graphical; Freeware.
    VanDyke Software, Inc.'s SecureFX
    Windows 2003, XP, 2000
    Macsftp
    Macintosh Classic; Fully graphical; Shareware.
    Fugu - A sftp frontend
    Macintosh OS X; Fully graphical; Freeware created and distributed by The University of Michigan.

    Back to FTP and SSH.
    2.4 Unix Commands

    This is a list of some of the programs available by function. There are many
    more. Commands are either executable files in the directories specified by the
    value of your PATH environment variable or built in commands defined by your
    shell (see the manual page on your shell).
    
    Mail:
            mail - Berkeley mail reader, very basic
            elm  - a nice mail reader
            pine - a very nice mail reader
    
    News readers:
            tin  - probably the easiest to use
            trn  - threaded news reader
            strn - complex news reader with scoring
    
    Infosystems:
            lynx    - http client (browse documents on http/ftp/gopher/etc sites)
            gopher  - gopher client (browse documents on gopher servers)
            archie  - archie client (search for files on ftp sites)
            define  - webster client (look up a words on a remote webster site)
            weather - local weather
    
    FTP clients:
            ftp   - transfers files over a network
            ncftp - a fancy version of ftp
            sftp  - securely transfers files over a network
            
    Editors:
            vi    - the standard unix editor, small, efficient
            pico  - a user friendly editor
            jove  - a small emacs-like editor
            joe   - feel of a `user-friendly PC editor'
            ed    - the most user-unfriendly editor ever written    
    
      Most programs that use editors (mail/news readers) will use the editor
      specified by the EDITOR environment variable.
    
    
    File manipulation:
            cp    - copies files
            mv    - moves files/directories
            cat   - concatenates files
            rm    - removes files/directories
            mkdir - makes directories
            chmod - changes file/directory permissions
            ln    - makes symbolic links
    
    Job control:
            ps    - lists your processes
            kill  - kills (send a signal to) processes
            jobs  - lists your background jobs
            fg    - puts a job in the foreground
            nohup - runs a program with hangup signals ignored
    
    File information:
            ls      - lists files/directories
            du      - displays disk usage
            strings - finds strings in a binary file
            file    - guesses the type of file
            find    - searches for files
    
    Compression/decompression:
            gzip/gunzip         - for 'z' files
            compress/uncompress - for 'Z' files
            zip/unzip           - for 'zip' files
    
    Archiving:
            tar
    
    Pagers:
            more - view a file one page at a time
            less -
    
    Downloading/Uploading:
            rz     - Z modem protocol
            sz     - Z modem protocol
            kermit - kermit protocol
    
    Shells:
            bash - sh the GNU way
            tcsh - enhanced c shell
    
    Text processing:
            awk    - a programming language for operating on files line by line
            sed    - stream editor
            grep   - search files for regular expressions
            cut    - display parts of each line of a file
            tail   - display the tail of a file
            head   - display the head of a file
            cat    - concatenate files
            sort   - sort lines of a file
            column - columnate lists
    
    Misc:
            cd       - change your current working directory
            date     - print the date 
            ssh      - used to connect to remote sites
            talk     - for conducting a conversation with a particular user
            tf       - the TinyFugue MUD client
            irc      - IRC client
            finger   - list basic information about a user or users at a site
            passwd   - change your password
            chsh     - change your login shell
            chfn     - change the information that appears when someone fingers you
            man      - browse manual pages
            uuencode - encode files for transmission via news/mail
            uudecode - decode uuencoded files
            uuxfer   - uuencode with a curses interface
            fortune  - prints a humorous message (nice for .profile)
    

    Back to FTP and SSH.

    2.5 Bourne Again SHell

    The manual page for bash is very long and can be confusing. Here are some 
    examples of some of the basic features. For a complete description of the 
    bash shell see `man bash'. 
    
    Home directories:
    
            ls -al ~
            echo ~
    
      In general ~ refers to your home directory.
    
    Redirection:
            
            w > ~/w.out
            ls -al /usr/bin > ~/ls.bin.out
    
      You can use `>' to redirect the output of commands to a file. Note that
      `>' will write over the destination file if it exists. To simply append
      to a file, use `>>'.
    
    Command history:
    
            echo !!
            history
            echo !2
    
      You can refer to previous commands using `!n' where `n' is the number
      of the command in your history list. You can repeat the previous command
      with the command `!!'. You can see your history list with `history'.
    
    
    Command line editing:
    
            ^p      -move backwards through your history list
            ^n      -move forwards through your history list
            ^f      -forward a character on the current line
            ^b      -backward a character on the current line
            ^d      -delete the current character
            ^k      -kill from point to the end of the line
            ^a      -move point to the beginning of a line
      
      Note that `^p', for example, is the character generated when you press the
      `Ctrl' key and the `p' key simultaneously.
    
    Pipes:
    
            ls /usr/bin | more
            ls /usr/bin | grep g | more
            ps -aux | grep root
    
      The pipe operator `|' connects the standard output of the command on the
      left to the standard input of the command on the right.
    
    Background jobs:
    
      Compare:
            sleep 5; echo foo
      to
            sleep 5; echo foo &
    
      An ampersand following a command causes the shell to run the command
      in the background, allowing you to do other things while the command is
      running.
    
    
    Variables:
    
            FOO=bar
            echo $FOO
            env
    
    Aliases:
    
            alias foo='ls /usr/bin | more'
            foo
    
    Starting up:
    
      When your shell starts up, the file ~/.profile is read and the commands
      in it are executed. Your profile file is a good place to put aliases.
    

    Back to FTP and SSH.

    2.6 vi

    The   vi   Editor
    
    I       Introduction
    
    Vi  is useful for creating new text, revising an existing text, and
    appending text to an existing file.  Although there are many
    commands available in vi, you will be introduced only to the
    commands for entering and exiting vi, moving the cursor, and
    inserting and deleting text.  You must refer to a Unix manual for
    other commands.
    
    II      The two modes of vi
    
    The vi text editor has two distinct modes of operation, the edit
    mode and command mode.  
            The edit mode is the mode in which you type text.  Each
    character appears on the screen as you type it.
    
            In the command mode, it is impossible to type text.  The
    command mode allows you to move the cursor around the text and to
    perform functions, such as deleting text and saving the file.
    
    III     Entering the vi text editor
    
     To create a new document in vi , simply type,  vi  "file name".  This
    command will display the vi editor screen accompanied by the name
    of the new document  followed by the statement, "[New file]".
    
    EXAMPLE:
    
    % vi practice 
    
    In this example, the new file "practice" is created. 
    
    
    The screen will look like this after opening a new file entitled,
    "practice".
    =============================================================
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    "practice" [New File]
    =============================================================
    
    IV      The Edit Mode
    
    Once in vi, you are placed in the command mode.  You cannot enter
    text in this mode.  If you try, the error bell rings and the letters you
    try to type will not appear on the screen.  This is because ordinary
    letters are interpreted as commands. 
    
     You must enter the edit  mode to type text. 
    
    To do so, use one of the following commands. The vi text editor is
    case sensitive, which means the same letters in upper and lower
    case have different command responses. 
    
    The letters a, A, i, I, o, and O  place vi  into edit mode.
    
            * the a command moves the cursor to the right one space
    
            * the A command moves cursor to the end of the current line
    
            * the i command inserts text in front of the cursor
    
            * the I command moves cursor to beginning of the current line.                    
    
    
    To correct mistakes while in the edit mode, use the backspace key to
    correct errors in  the current line you are typing.  As you backspace
    to correct the mistake, characters remain on the screen although
    they are erased in the computer's memory.  This looks confusing but
    don't be worried by it.  To correct mistakes in lines other then the
    current line, you must first enter the vi command mode.  This will
    allow you to move the cursor to the line you want to edit (see
    section VI.)
    
    V       Leaving the Edit Mode and Moving the Cursor
    
    To return to the command mode simply press the ESC key.  (Hint: if
    you are not sure which mode you are currently in, press the ESC
    anyway.  If you were already in command mode, you will stay in the
    command mode.)  In the command mode, it is possible to move the
    cursor up, down, left or, right by using the arrow keys on the
    keyboard.  However, no matter what type of keyboard you have, it is
    possible to use the vi commands, h, j, k, and l, all in lowercase, to
    control the cursor.  
    These commands move the cursor as follows:
    
            * the j command moves the cursor up one line
    
            * the k command moves the cursor down one line
    
            * the h command moves the cursor backwards on a line, similar
            to the backspace key
    
            * the l command moves the cursor forward on a line, similar to
            the spacebar.
    
    If you want to insert text, simply move the cursor to the desired
    area, while in the command mode,  return to edit mode and type the
    text.
    
    
    VI      Deleting Text
    
    It is only possible to delete text  while in command mode. (See
    section VI for entering command mode.)
    
            *the dw command deletes the word the cursor is on.
    
            *the dt command deletes everything from the cursor to the
    next period on the current line.  This is a good way to delete words
    to the end of the sentence without deleting the period.  
    
            *the d(  command deletes everything from the cursor to the
    beginning of the next sentence.  After moving the cursor to the
    beginning of a sentence, you can use this command to quickly delete
    that sentence.
    
            *the dG command  deletes everything from the cursor to the
    end of the file
    
    
    
    VII     Editing an Existing File
    
    It is also possible to edit an existing file. In this case,  enter by 
    typing vi followed by the name of the file to be edited.
    
    EXAMPLE:
    
    % vi "letter"
    
    In this case the user entered  vi  and opened an existing file entitled,
    "letter".  The text of the file requested appears on the screen.  At
    the bottom of the screen the file name, # of lines in the text, and #
    of characters in the text  appear.
    
    EXAMPLE:
    =============================================================
    To whom it may concern,
    I am interested in signing up for the data communication class that
    the school of design is offering in the fall.  I am a student of the
    colleges and need this class to fulfill my major.  If you could send
    me the application form, I would greatly appreciate it.  It would be
    best to send the form to me through the internet in a email message. 
    My address is as follows
    
    Jack Straw
    576 St. Paul Blvd.
    New York, NY 10021
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~"letter"  10 lines, 387 characters
    =============================================================
    
    VII     Saving Your Work and Exiting the vi Text Editor
    
    To save your text, first enter the command mode.  Once in command
    mode, it is possible to save and exit, or to exit without saving.  The
    command sequence is as follows
    
     :w     saves your text
    
     :q     quits vi 
           
     :wq    saves and quits vi 
    
    These commands are examples of what are called last line
    commands.  When they are used, the cursor moves to the bottom of
    the page.  Your commands and the systems response are displayed
    there.
    
    
    IX      Conclusion
    
    There are many other commands for the vi editor.  Entire books have
    been written explaining the use of vi commands.  The purpose of this
    brief guide is to introduce you to enough basic vi commands for you
    to do useful work.  To learn about more advanced features, refer to a
    Unix manual or a book on vi.
    

    Back to FTP and SSH.

    2.7 Changing your shell password on NMIA

    You may change your password to your shell account when logged into home.nmia.com in your SSH session. See SSH if you need help doing so. Type the command "passwd" at your shell prompt. You will be prompted to enter your current password and then your new password. Then, email help@nmia.com and ask us to 'propagate' your shell password - this synchronizes your shell password on all servers. This only changes your shell password (email, FTP, SSH, etc.). It does not change your dialup (PPP) password. If you want the dialup password changed to the same as your shell password, email us at help@nmia.com requesting us to make the PPP password the same as the shell password. There is no need to send your new password in the email and we discourage you in doing so.

    Back to FTP and SSH.

    Counters, CGI, forms and access control on NMIA

    3.1 CGI on NMIA

    Overview

    NMIA serves user
    cgi scripts via a wrapper program. The wrapper program executes a user's script using the user's uid as its effective uid. In other words, the cgi script has the same `permissions' as the user that owns it. The script can do anything that the user could normally do.

    Getting started

    You can serve cgi scripts, but there are some dire warnings you should know about first. It is possible to write a simple script which will destroy everything in your account directory, or make very subtle changes in it that would be difficult to diagnose. That is, you should know a good bit about unix and shell programming and possibly about perl or other languages you intend to use, before setting scripts loose to be run by strangers through your web site.

    But, if you wish to proceed you should:

  • create a cgi-bin directory in your public_html directory if one doesn't exist
  • copy a script there called test-cgi which you can use to test the cgi setup.
  • You can find this file at: /home/common/html/cgi/test-cgi
  • send mail to www saying that you've read the warnings and want to serve cgi scripts anyway
  • know that all cgi scripts must be run under the cgiwrap program

    Using the wrapper to call your scripts

    After your cgi-bin directory has been enabled, you can access scripts under it with a URL like: http://www.nmia.com/cgi-bin/cgiwrap/YOUR_USERNAME/YOUR_SCRIPT Where YOUR_USERNAME is your username and YOUR_SCRIPT is the path to your script relative to your public_html/cgi-bin directory. For example, if the user named foo wanted to execute the test-cgi script in ~foo/public_html/cgi-bin, she would use: http://www.nmia.com/cgi-bin/cgiwrap/foo/test-cgi You can put cgi scripts in subdirectories of your public_html/cgi-bin directory. If part of the path is a program instead of a directory, it will be executed with the rest of tha path passed to it as PATH_INFO (like a normal, unwrapped cgi).

    Debugging your cgi scripts

    You can use cgiwrapd in place of cgiwrap to produce helpful debugging info.

    If you get a 500 Server Error error message, your script has generated an invalid HTTP reply to a client's request for your script. The most common mistakes are:

    • Transferring files using the wrong ftp transfer mode.
    • Not generating a Content-Type header or not leaving a blank line after your HTTP headers.
    • Making a programming mistake which leads to an error message (often interpreted as a bad HTTP header).

    Programming resources

    The most popular programming language for CGI applications is Perl. NMIA has support for Perl version 5 including the Perl module CGI.pm which greatly simplifies the writing of CGI scripts.

    If you're going to program in Perl, or simply want to confidently configure Perl scripts that you find on the web, you will find the O'REILLY books on Perl and CGI very helpful.

    You can find Perl scripts on the web at a number of locations. A good place to start looking is the Yahoo CGI Perl script section.

  • Back to Counters, CGI, forms and access control on NMIA.

    3.2 Adding a Page Counter on NMIA

    To add a page counter, simply add a line to your html file of the form:

    <img src="http://www.nmia.com/cgi-bin/counter?TAG"> where TAG is a unique identifier for your page. An example of this is if you username is "foo" then enter: <img src="http://www.nmia.com/cgi-bin/counter?foo"> If you need a separate counter on another page, use a different name like <img src="http://www.nmia.com/cgi-bin/counter?foo2"> To reset a counter back to zero, just rename it to a different unique name.

    For example, the following:

    <img src="http://www.nmia.com/cgi-bin/counter?counter.html"> produces the following counter: which shows how many times this page has been accessed.

    For more information about the counter see ssd's counter page.

    Back to Counters, CGI, forms and access control on NMIA.

    3.3 Using Forms on NMIA

    Forms allow you to collect information from people that look at your page. Form interfaces are simple and easy to use.

    For Mail, we provide our users with:

    Mail Interface
    This interface sends form data as mail to addresses that you specify. If you want to send your form data via email, this is the recommended way to do it.

    To do this, you'll need to know how to write an html form. A good place to start learning about forms is An Instantaneous Introduction to CGI scripts and HTML Forms.

    If you have questions about forms in general, your best bet is to post to one of the www newsgroups.

    Back to Counters, CGI, forms and access control on NMIA.

    3.4 FormMail

    What is FormMail?

    FormMail is a freely available script available from
    Matt's Script Archive. It is highly configurable and is recommended over the older form-mail (note the dash ) script.

    How to use formmail

    To use Formmail, you must do two things. First, you must use the following URL as the value of the action attribute of your form:
    
                    http://www.nmia.com/cgi-bin/formmail
    
    

    Second, you must add input tags in the form section of your page that modify the behavior of the formmail script.

    If you wish to send these messages using a domain that we host, you must email 'help@nmia.com' and let us know. Otherwise, your messages will not be allowed.

    Only one input tag is required. You must have an input tag that has the name recipient and your email address as its value.
    For example:

    
                    ‹input type=hidden name="recipient" value="devnull@nmia.com"›
    

    If you want to send to multiple recipients, just make the value a list of email address separated by commas (no spaces). For example:

                    ‹input type=hidden name="recipient" value="addr1@nmia.com,addr2@foo.com,add3@bar.com"›
    

    For a description of the optional input tags that you can use to customize the behavior of formmail, take a look at the formmail documentation.

    Back to the forms help.


    3.5 Controlling access to your pages

    3.5.1 Access Control

    Access control on our http server is controlled by directory. All files in a particular directory have the same authorization requirements.

    There are two forms of access control, user authentication and host filtering. User authentication involves setting up a password file, assigning usernames, and assigning passwords. If you want someone to access your page, you tell them to use a particular username/password combination. Host filtering simply allows access to some hosts and denies access to others.

    3.5.2 User Authentication

    In order to control access by user authentication, you'll need to create a file containing user/password correspondences and tell our server to use that file to authenticate users.

    You create the file by using the htpasswd program. To tell our server to use user authentication in a particular directory, you just create a file named .htaccess in the directory that you want to protect and put in the appropriate access control directives.

    If you just want to jump in without reading the documentation, you can probably modify the following example to suit your needs. Otherwise, visit this site for more detail. Suppose that I want to create a directory where I can put files to be accessed only by people who have a password that I've given them. Here's what I'd do:

    Create the directory

    I'll call my diretory `private' and put it directly under my public_html directory: mkdir ~/public_html/private chmod go+x ~/public_html/private

    Create the password database

    I'll add a couple of users, one for me and one for my friend, Opus:
    
            htpasswd -c ~/.my_passwd_file ron
            htpasswd ~/.my_passwd_file opus
    
    
    In each case, I'll be prompted to for a password. The first command has a -c. That tells htpasswd that we're starting a new password file. Don't use it on subsequent commands unless you want to wipe your old password file.

    Tell the server

    To tell the server to use authentication, I'll create a .htaccess file in ~/public_html/private. To do this, I'll use my a text editor and I'll put the following in it: AuthUserFile /home/foo/.my_passwd_file AuthGroupFile /dev/null AuthName "Foobar's Private Area" AuthType Basic <Limit GET> order deny,allow require valid-user </Limit> For a complete explanation, of these directives, take a look at the access configuration docs. The two important lines are the ones beginning AuthUserFile and AuthName. The AuthUserFile line tells the server to use my password file to authenticate users. The AuthName is just a string that is used when the client prompts for a password. It lets the user know what username and password she should use. If it contains spaces, it must be surrounded by double quotes.

    Now, when I try to access:

    
                    http://www.nmia.com/~foo/private/
    
    
    I'll be prompted for a password. When playing around with passwords, remember that your client probably remembers passwords so that once you give a valid password, you won't be prompted again until you restart the client.

    Back to the forms help.

    Back to the top of the page.


    3.6 PHP on NMIA

    PHP is a preprocessor for HTML.

    There are two ways to run a php stript on our system. The script can be placed in your cgi-bin, or run from any location under your public_html.

    To process one of your pages with PHP, it is a good idea to put the page under your cgi-bin directory, but it is not necessary. If you choose to put the php script in you cgi-bin the first line of the script must be:

    #!/usr/local/bin/php

    You would reference the page as:

    http://www.nmia.com/cgi-bin/cgiwrap/USERNAME/SCRIPTNAME

    where USERNAME is your username and SCRIPTNAME is the path to your page relative to your cgi-bin directory.

    Using PHP with the cgiwrap program causes the script to run using your user id, rather than the web process. Running PHP scripts without the cgiwrapper works as one would normally expect, but causes the script to run with the id of the web process. If any sensitive information is being processed by the php script, running as the web process is a dangerous proposition and may allow any other user on our systems to access that same data, since any script they might write will also run as the web process and thereby have the same privilege as your script.

    If you are processing sensitive information, we would suggest that you also understand Unix file permissions, as this is an important part of protecting your data. There are a number of good books on Unix that include information about file permissions, and there are probably a good number of informational web sites that might be found by doing a search on google. We would also be happy to discuss the subject with you further if you like.

    Back to Counters, CGI, forms and access control on NMIA.

    Publicizing your web page and other fun stuff

    4.1 Spreading the word about your page

    How to do it

    Most people find out about web pages by using one of the popular search engines like
    Lycos or a large catalogue like Yahoo.

    Here are some ways to add links to various places:

    You can also use the Submit It! form to register your page with several sites at once.

    If you come across a page where you think that a link to your page would be appropriate, there's no harm in sending email to the owner of the page asking for a link. Most pages contain author contact information.

    Many people have a pointer to their home page in the signature that they use for Usenet news postings and email.

    How not to do it

    You should avoid simply announcing your page on a Usenet newsgroup, particularly if it's a commercial page. If you maintain a page with information that answers a question that you see asked in a newsgroup, it's acceptable to post a pointer to that page.

    The same holds true for mailing lists.

    Back to Publicizing your page and other fun stuff.

    4.2 WWW Newsgroups

    Newsgroups are uncensored collections of information on any topic you can think of. You can access those groups by going to Deja News or by getting a news group client. Such clients are later versions of Netscape Navigator, Outlook Express, or Forte Inc's Free Agent.

    The following newsgroups have information about the WWW:

    When connected to NMIA you do not need to login or supply a username and password to get the newsgroups that are on our server. Just use the server news.nmia.com.

    Back to Publicizing your page and other fun stuff.

    4.3 Instructions for tracking Web page accesses

    This page refers to commands. The commands must be entered at a UNIX (or "shell") prompt. To get to such a prompt, you need to SSH from your machine to the NMIA machine plato.nmia.com.

    Raw Data

    You can keep track of http accesses to your files, or `hits', with the command: httpd_hits The command httpd_hits prints out a raw log to your terminal. The command: httpd_hits >log.txt will create a file in your current working directory named `log.txt'. You can download that file and analyze it on your home computer or use standard unix tools on NMIA machines.

    The output of httpd_hits is updated once an hour. At the end of every month, the logs are saved and a new log file starts. You can retrieve the old log file until the end of the month by invoking httpd_hits with the -o:

    httpd_hits -o >log.txt

    Summary of Hits

    You can get a basic summary of your hits with the command: httpd_hits_summary If the output scolls off your screen, you can page through it: httpd_hits_summary | more or redirect it to a file: httpd_hits_summary >file.txt

    Options

    Either command will take -o as an argument in which case it will display information corresponding to the previous month. httpd_hits_summary -o httpd_hits_summary -o | more httpd_hits_summary -o >file.txt

    httpd_hits will take -c as an argument in which case it will print hits in the NCSA Combined format. This option is useful for producing a file that can be read by standard log file analyzer programs:

    Format

    The format of the data presented by httpd_hits is NCSA Combined Servername. In general, you only need to know the format if you are using a commercial log analyzer. Not all log analyzer programs understand this format. See the -c option above for an alternate format.
    Back to Publicizing your page and other fun stuff.

    Back to the top of the page.

    Maintained by NMIA.
    All rights reserved. Last modified: Dec 2002