COSC 4390 Internet Computing: Computera, Web Site, and Web Server
Fall 2006, Section 10063
Index
- Computer Accounts
- CS Unix Clusters
- Setting up HTML and CGI
- Restricting Access
- Running Java on CS Domain
- Using CGI.pm on Our Server
1. Getting an account:
For UH computer accounts, visit the IT office on the first floor of PFG. The instructor will not issue course accounts on UH computer system.You will need a Computer Science account since there is no Web Server installed on Bayou (or other UH server) for student use. Any student (CS or otherwise) in this class is entitled to a CS course account. Fill out a CS account request form in 501-PGH. It may take three days to get your account activated.
2. Computer Science Unix Cluster
You may use any work station in the Computer Science Workroom (547-PGH). You may also telnet to some of these machines. See the System Admin page of the Department. You should use the complete node names such as pegasus.cs.uh.edu. Actually, "telnet" has been replaced by SSH (Secured shell) - a more secured way to remotelly access our system. There are free software available to connect to CS servers.3. Setting up HTML & CGI
Following the following steps to set up your own web page and your own CGI directory. This applies to the Computer Science accounts (cs.uh.edu, see above) only.- Create a subdirectory "www" (lower case) under your root (say, user name = "john"). This subdirectory ("~john/www") is now your default web directory (http://www2.cs.uh.edu/~john).
- Set the protection of your file system to allow other users to READ and EXECUTE your files in the www subdirectory ONLY. Ask for help if you don't know how to do it.
- Create a file called "index.html". This is the default html on our server. This page will be "on the web" as http://www2.cs.uh.edu/~john (or whatever your user name is).
- Create a subdirectory "cgi-bin" under www. Set the protection appropriately.
- Add an entry to access control file (.htaccess) in the directory (cgi-bin)
where your cgi scripts are located. Add the following line. You may change the file
extension (.cgi, .pl). You may have multiple file extensions.
AddType application/x-httpd-cgi .cgi AddType application/x-httpd-cgi .pl
- Again make sure the files can be read and execute by others.
- Now test a CGI of your choice.
4. Restricting Access
Everyone in this class should create a homework directory and protect it from public view. This document shows you how to set up password protection to your files on the CS domain. There will be a penalty for those without proper protection to their homework files.Step 1. By creating a file ".htaccess" in your homework directory (~john/www/hwk), all files in that directory will be protected by the password. Here is what you need to put in the .htaccess file.
AuthUserFile /your-full-path-name/.htpasswd AuthGroupFile /dev/null AuthName ByPassword AuthType Basic <Limit GET> require user whatever </Limit>The file refers to a password file which you can put anywhere you like in your directory system. You have to use the full path name of the file in the first line. The user name "grader" was used in the above example.
Step 2. You will have to create a password file next. Do this in the directory specified in Step 1. Run the htpasswd with the user-name as shown below. Type in and confirm the password you choose. The password will be encrypted (take a look). Note: At this time, not all systems in the CS cluster support this htpasswd command. If you have problem, use linux04.cs.uh.edu.
linux04% /usr/apache/bin/htpasswd .htpasswd whatever Adding user grader New password: xxxxxxx Re-type new password: xxxxxxxAdd a "-c" option when you run htpasswd for the first time. This will create the file for you.
Step 3. Now, change the file mode to executable only. In /www, do "chmod 701 hwk". Set all files in the hwk directory to 705 (readable and executable). Don't worry, the password is encripted.
5. Running Java on cs.uh.edu Domain.
To access java in our system, follow the instructions below.
Step 1: Log into any Solaris machine in the department (PGH-547). Machine names (subject to change):
- peregrin,
- owl,
- mockingbird,
- petrel,
- osprey,
- seagull,
- toucan,
- woodrock,
- tern.
Step 2: Read system document at " Java news: Sunsoft jdk-1.1 installed".
Step 3: Add the following lines in the .cshrc file before you login to solaris machines.
setenv JAVA_HOME /opt/java/jdk1.1 setenv CLASSPATH .:/opt/java/jdk1.1/lib/classes.zip alias javac '/opt/java/jdk1.1/bin/javac' alias java '/opt/java/jdk1.1/bin/java' alias av '/opt/java/jdk1.1/bin/appletviewer'To compile a java program named myProgram.java:
javac myProgram.javaTo run a Java application:
java myProgramTo run an applet (myProgram.html):
av myProgram
Get one of the sample Java programs from my example list and test it out. Have fun.
6. Using CGI.pm on Our Server
If CGI.pm is not installed on the Perl on our web server, you cannot use CGI (at least as of this writing of the document) directly. Here is how you can get around it.- Download Perl CGI.pm from Perl.com or other perl sites.
- Edit CGI.pm to change "require 5.004" to "require 5.002" if our server's perl version is older than the CGI's requirement.
- Put the file in your cgi-bin directory.