Maintaining Personal Web Pages


Creating a Home Page Automatically

Users can create a personal home page and set permissions for it automatically. Simply go to http://www.wfu.edu/update.html and follow the instructions.

Students who need web space for a student organization web site should contact the Informations Systems Support Center at HELP (x4357) to establish an account. You will need to supply:

  • Name of the Organization
  • Purpose (if it’s not obvious from name)
  • Full name and username of the webmaster/administrator(s)

Creating a cgi-bin directory

WFU users can create a cgi-bin directory to house any CGI scripts they may want to use. CGI, or Common Gateway Interface, relies on perl and other programming languages to add functionality to web pages. There are many publicly available CGI scripts that can handle such tasks as creating guestbooks, generating random content or automating e-mail forms.

A collection of scripts is available from the NMS script archive.

To use CGI scripts on your site, follow these steps:

  1. Create a cgi-bin directory in your www-home directory and make it world readable.
  2. Move all your scripts to the cgi-bin directory and make sure they are all executable by you (chmod 700 or above). Make sure they are NOT writeable by anyone but you.
  3. Make sure they are owned by you, and belong to the same login group as you.
  4. Change all links to normal scripts to:
    /cgi-bin/cgiwrap/~userid/scriptname

Make sure any local references to files in your scripts are changed to absolute path names (eg. picture.gif =/users/other/center/user/www-home/images/picture.gif) or are corrected to adjust to the change in location of the script.

The following Unix shell commands will create the directory for you, and move any existing scripts into it:

cd $HOME/www-home
mkdir cgi-bin mv *.cgi cgi-bin
chmod -R a+rx cgi-bin

Point URLs to your CGI script

To point a URL to your script, use the following syntax:

http://www.wfu.edu/cgi-bin/cgiwrap/~yourlogin/yourscript

So, if you have a script named test.cgi in your home directory, located in the www-home/cgi-bin subdirectory, and your user login is mozilla, then the URL for your script would be:

http://www.wfu.edu/cgi-bin/cgiwrap/~mozilla/test.cgi

You can abbreviate the URL as:
/cgi-bin/cgiwrap/~mozilla/test.cgi

Using passwords to control access to pages

Wake Forest users can protect directories of their site (and the files they contain) by using configuration files for access control. To do so, first create a text file named .nsconfig and place it in the directory to be secured. The file must be world-readable, and contain a RequireAuth or RestrictAccess entry (described below), which must fit on one line. Next, decide what level of access you want to allow. Each example below offers differing levels of access.

Example 1
The following lines within a .nsconfig file would allow only people in the 10.*.*.* network range (Reynolda Campus) or wfu.edu to access the directory and files:

<Files *> RestrictAccess type=allow ip=10.*.*.* | dns=wfu.edu return-code=403 </Files>

Example 2
This .nsconfig file would require people to enter their AC password to access the directory and files:

<Files *> RequireAuth dbm=”/pub/ns-home/userdb/wfu” realm=”WFU Academic Computing” </Files>

Example 3
This .nsconfig file would require people to enter a special password, specified in the “passwords” file, which is an NCSA style password file. Note that the “Path” portion of the line below must be edited to reflect the path to the proper directory.

<Files *> RequireAuth userfile=”/pub/gopher-data/Path/passwords” realm=”passwords” </Files>

To create the “passwords” file, you would use the htpasswd command on AC. The -c option creates a new file. Here is an example of how to use the command to create a file named passwords:

htpasswd -c passwords test

Adding password for test.

New password:

Re-type new password:
To add additional passwords, repeat the command without the -c option. Now make the file readable:
chmod a+r passwords

Example 4
This .nsconfig file would require people to enter their AC password, would limit access to specific users listed in the userpat entry portion of the line, and would restrict access to people with network numbers in the 10.*.*.* range or wfu.edu. (NOTE: There are two lines in this example, the RestrictAccess line and the RequireAuth line. The RequireAuth line has been broken here for legibility — it must be on one line to work correctly.)

<Files *> RestrictAccess type=allow ip=10.*.*.* | dns=wfu.edu return-code=403 RequireAuth dbm=”/pub/ns-home/userdb/wfu” realm=”WFU Academic Computing” userpat=”(username1|username2|username3)” </Files>

A warning about using .nsconfig: If the .nsconfig file becomes corrupted, or not world-readable for some reason, access control may be compromised! For this reason, it is safest to use MULTIPLE .nsconfig files in nested directories. For example, to restrict access, place a very restrictive file in the top-level directory, and set permissions and ownerships on the file to make it very difficult for the file to be modified. Then, in each subdirectory, set up less restrictive .nsconfig files. This way, if the less-restrictive .nsconfig file is removed or modified, the more restrictive file in the parent directory should take over, and access will become more restrictive, not less.

Current date

The following code will display the current date in any style text you wish.

<!–#exec cgi=”/cgi-bin/textclock.pl”–>

Modifying it with the tag

<FONT COLOR=”660000″>

Results in:

Last date modified

The following code will display the modification date of the document it is placed on.

Last modified: <!–#echo var=”LAST_MODIFIED” →

As in:
Last modified: Monday, 16-Apr-12 16:36:35

Access counts

To include access counts in documents, add the following:

Access count: <!–#exec cmd=”/pub/gopher-data/cgi-bin/access_count username-docid” →

Replace username-docid with your user name and an ID of your own choosing for the document. For example, if your username is Mary, and you want to keep an access counter for your home page, you could use:

<!–#exec cmd=”/pub/gopher-data/cgi-bin/access_count mary-home” –>

 

Was this article helpful?

Need Help?

Contact our Service Desk, conveniently located in the ZSR Library.

Hours