The College of New Jersey
The main College website can be found at www.TCNJ.EDU.
This is the web server that runs the CGI programs that members of the campus community program.
It is separate from www.TCNJ.EDU so that a rogue CGI program can't take down
the entire web site.
First and Foremost
You should make sure that any CGI program you run or write is security conscious.
If you don't understand the source code, don't run it. A poorly written CGI program
can crash the server, and carelessly written CGI programs can breach system security.
If you aren't familiar with CGI security concerns, buy a book on UNIX CGI programming and
read it, twice! If you still don't understand, don't put CGI programs on the system.
How to Use It
You should first setup your account for general web page serving. This means you
need to setup the proper permissions on your home directory and "www" directory. Connect to beast.tcnj.edu, login and run
the wwwsetup program if necessary.
Now you need to setup a "cgi-bin" directory to store your programs. For security reasons, this
directory needs to be made at the top of your home directory, NOT in your "www" directory. These steps
will create this directory in your home directory (on the same level as "www") and setup the
proper permissions for it:
chmod 711 cgi-bin
You can now put your CGI programs in the "cgi-bin" directory. For Perl and other non-compiled
CGI programs, you need to set the permissions on them with the following command:
chmod 755 your_cgi_program
of course, replace your_cgi_program with the name of the CGI program you put in that directory.
If you have a compiled CGI program, such as one written in C or C++, the above command will
work, but to be even more security conscious, use this instead:
chmod 511 your_cgi_program
Now you can create a URL to your new CGI program. In the example, I will use "ssivy" as
the user's account name and "counter.cgi" as the name of the CGI program. Substitute your
account name and CGI program appropriately.
NOTE: Your CGI program MUST end with .cgi no matter what language it was written in.
How It Works
Just like how www.TCNJ.EDU serves web pages out of your "www" directory, cgi.TCNJ.EDU serves CGI programs out of your "cgi-bin" directory. The way it tells a CGI program from a regular web page is by the .cgi file extension.
Using Server-Side Includes (SSI) on cgi.TCNJ.EDU
Simply create a web page with a .shtml suffix in your cgi-bin directory and include the SSI directives you want.
Using PHP 5.0 on cgi.TCNJ.EDU
Simply create a web page with a .php suffix in your cgi-bin directory and include the PHP 5.0 code you want in your page.
Here are some additional references on CGI programming.
CGI Programming on the World Wide Web, published by O'Reilly & Associates, Inc.
Programming Perl, 2nd Edition, published by O'Reilly & Associates, Inc.