Updated: 2018-04-12 04:48 EDT

1 Create your own course web siteIndexup to index

Follow these directions to create your own web site on the Course Linux Server.

If you have problems or see any server errors in your web browser, such as Internal Server Error or Forbidden, see the section below titled Errors, Troubleshooting, and Logs.

public_html

index.html

  1. Make sure your HOME directory is in group www-data and has group search permissions enabled. (If the group is wrong, talk to your professor to get it fixed.)
  2. Create a directory public_html in your HOME directory.
  3. Change the permissions on public_html to remove write permission for group and for other and enable search permission for other. (Do not change any other permissions! Directory mode rwxr-xr-x is good.)
  4. Make public_html your current directory.
  5. Copy the file ~idallen/cst8207/18w/cgi-bin/index.html into the current directory. (There is a tilde character in that pathname.) Make sure the file is readable by others.
  6. Use a web browser to access URL http://cst8207.idallen.ca/~abcd0001 where abcd0001 is replaced with your CLS userid. (There is a tilde character in that URL.)

Your web browser should get no errors and you should see a web page with heading Your Name.

If you have server errors or other problems, see the section below titled Errors, Troubleshooting, and Logs.

  1. Edit the index.html file to put your own information in it:
    1. Replace all occurrences of the userid abcd0001 with your own Algonquin userid.
    2. Replace all occurrences of the two words Your Name with your own name. (Replace all of them!)
    3. VIM can do these changes instantly with a substitute command.
  2. Open the page in your web browser and use the two W3C buttons at the bottom of the page to validate the HTML and CSS in the page to make sure there are no errors. Fix any errors that are found.

.htaccess

  1. Put the two-word line Options +ExecCGI in file .htaccess in the public_html directory. (Word count: 1 2 17) Make sure the file is readable by others.

Make sure you can still access the above web page without errors. If you have server errors or other problems, see the section below titled Errors, Troubleshooting, and Logs.

2 Choose your Privacy settingsIndexup to index

Choose the privacy settings for your web site.

If you have server errors or other problems, see the section below titled Errors, Troubleshooting, and Logs.

2.1 Open access to the world: allow everyone, everywhere on the InternetIndexup to index

Open access to the Internet is the default setting for your web site. No further changes are needed to allow open access. By default, everyone on the Internet can see your web site.

2.2 Access Controls: Restricted access to your site: you choose the sitesIndexup to index

Turning on Access Controls is optional. You don’t need to do this.

If you don’t want your web site to be visible on the whole Internet, turn on optional Apache Access Controls following these directions:

.htaccess

To turn on optional Access Controls, start by appending these four lines to the one-line .htaccess file that you created above (and note there is no space after the comma):

Order deny,allow
Deny from all
Allow from 127.
Allow from .w3.org

If you enable optional Access Controls, you must permit Course Linux Server localhost access to your web site by allowing IP address prefix 127. to access your site. You should permit W3C validation access to your web site; without this, the validation buttons won’t work.

To permit Algonquin College internal (private) addresses to see your web site, also append this line to your .htaccess file (there are spaces between the two IP address prefixes):

Allow from  10.  192.168.

To permit other addresses or sites, append more Allow from lines, giving the full or partial domain name or full or partial IP address. Multiple IP addresses or domains can be specified on the same line, separated by spaces, e.g.

Allow from 205.211.  .algonquincollege.com
Allow from .teksavvy.com  .rogers.com  .bell.ca
Allow from 167.88.21.

If you do not allow localhost access via 127. your web site cannot be viewed or tested by your instructor. You must allow access to 127.

If you do not allow access from the .w3.org domain name, you will not be able to use the W3C validation buttons to validate your pages.

If you do not allow your home IP address or domain name to access your web site, you will not be allowed to view your site from home.

Make sure you can still access your web page without errors.

If you have server errors or other problems, see the section below titled Errors, Troubleshooting, and Logs.

2.2.1 Example Restricted Access .htaccess fileIndexup to index

Below is a sample Restricted Access .htaccess file with optional Access Controls enabled. Some of the Allow from lines in your file may be different:

Options +ExecCGI
Order deny,allow
Deny from all
Allow from 127.
Allow from .w3.org
Allow from 10.  192.168.
Allow from 205.211. .algonquincollege.com
Allow from .teksavvy.com .rogers.com .bell.ca
Allow from 167.88.21.

You must permit access from 127. and you should permit access from .w3.org to allow W3C validation. Everything else is up to you.

Access Controls are optional. Your site will be visible to the entire Internet if you do not use any optional Access Controls.

If you have server errors or other problems, see the section below titled Errors, Troubleshooting, and Logs.

3 To upload an image file to your siteIndexup to index

To upload an image, you need to install the uploading CGI program using the directions below.

If you have server errors or other problems, see the section below titled Errors, Troubleshooting, and Logs.

  1. Make sure your public_html directory exists and has the correct permissions. (See above for the correct permissions.)
  2. Make public_html your current directory.

upload.html

  1. Copy the file ~idallen/cst8207/18w/cgi-bin/upload.html into the current directory. Make sure the file is readable by others.

upload.cgi

  1. Copy the file ~idallen/cst8207/18w/cgi-bin/upload.cgi into the current directory. Make sure the file is readable and executable by others.
  2. Edit file upload.cgi and add an upload password to the file. (Follow the instructions in the file.)
  3. Make sure Options +ExecCGI is set in your .htaccess file.
  4. Use a web browser to access URL http://cst8207.idallen.ca/~abcd0001/upload.html where abcd0001 is replaced with your CLS userid.
    • There is a tilde character in that URL.
    • If you have turned on optional Access Controls, make sure you permit access to your web site from your current IP address!
  5. Use the Browse button to find on your computer an image to upload.
  6. Enter your upload password in the Password box. (This is the same password you entered as PASSWORD= in your upload.cgi file.)
  7. Select Upload Image.

The image file will be uploaded into your public_html directory.

If you see any server errors in your web browser, such as Internal Server Error or Forbidden, see the section below titled Errors, Troubleshooting, and Logs.

If you have turned on optional Access Controls, make sure you permit access to your web site from your current IP address!

4 Upload a head-shot picture of you: me.jpgIndexup to index

If you have turned on optional Access Controls, make sure you permit access to your web site from your current IP address!

If you have server errors or other problems, see the section below titled Errors, Troubleshooting, and Logs.

me.jpg

Upload a clear head shot JPEG picture of you into the file me.jpg in your public_html directory. (If you don’t have a picture, ask a friend to take one for you.)

  1. The head shot should show your face clearly. No face; no marks.
  2. The image must be no smaller than 300 pixels in height or width and no larger than 1024 pixels in height or width.
    • The file or identify commands will tell you the size of your image.
    • See below for a way to change the pixel size of an image file.
  3. The file size must be smaller than 1 MB.
  4. The file format must be JPEG with name and file extension me.jpg located in your public_html directory. (You can move/rename a file on the CLS after you have uploaded it.)
  5. The file must have “other” read permission.

4.1 How to resize an image file using convertIndexup to index

You can resize an image named in.jpg to 300 pixels wide and put the new size image in out.jpg using this CLS command line that uses the convert program from the Image Magick suite of programs (RTFM):

$ convert -resize 300x in.jpg out.jpg

The input image can be any size in any format (e.g. JPEG, GIF, PNG). The output file format should be (for this web site) a JPEG format file using file extension .jpg

The file or identify commands will tell you the size of your image.

5 Class Photo MontageIndexup to index

A clickable public montage of all the uploaded head-shot pictures is available at http://cst8207.idallen.ca/montage18w.cgi

This page is available to everyone on the open Internet. If you do not want your image shown on the montage page, follow the directions at the bottom of the page and then touch your photo to get the page to rebuild.

The montage18w.cgi file is a shell script that builds the image file. You can log in and look at this shell script on the Course Linux Server using this pathname: /var/www/html/montage18w.cgi

6 Errors, Troubleshooting, and LogsIndexup to index

If you see any server errors in your web browser, such as Internal Server Error or Forbidden, this section is for you.

  1. Make sure the permissions and group are set correctly on your HOME directory.
    • Your HOME must be in group www-data with search permission for “group”.
    • If the group of your HOME is not www-data, get your instructor to fix it.
    • You must enable search permission for “group”.
  2. Make sure the permissions are set correctly on your public_html directory under your HOME directory.
    • Your public_html directory should have mode rwxr-xr-x
    • Your public_html directory must be a directory, not a file!
  3. Make sure the permissions are set correctly on each of the files inside your public_html directory:
    • All .html files must be readable by “other”.
    • All .cgi files must be readable and executable by “other”.
  4. If you have turned on optional Access Controls, make sure you permit access to your web site from your current IP address!
    • You can temporarily add Allow from all to your .htaccess file to allow access from all IP addresses if you think that Access Controls might be the problem.
    • If your site won’t display even with Allow from all set, you have some problem other than Access Controls. Check the Apache and CGI suexec error logs (below).

Here are two useful Apache web server log files you can read on the CLS:

If you see any errors in your web browser, such as Internal Server Error or Forbidden, go back to the CLS command line and look at the last few lines in the Apache error log file /var/log/apache2/error.log to see what went wrong and fix it.

If you see suexec policy violation in the error log, look on the CLS at the last few lines in the suexec log: /var/log/apache2/suexec.log for hints. (Did you correctly change the permissions of public_html?)

Files that you want visible on your web site must have read permissions for other so that the web server can serve them. If you take away other read permissions, the files will be flagged as Forbidden.

Author: 
| Ian! D. Allen, BA, MMath  -  idallen@idallen.ca  -  Ottawa, Ontario, Canada
| Home Page: http://idallen.com/   Contact Improv: http://contactimprov.ca/
| College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/
| Defend digital freedom:  http://eff.org/  and have fun:  http://fools.ca/

Plain Text - plain text version of this page in Pandoc Markdown format

Campaign for non-browser-specific HTML   Valid XHTML 1.0 Transitional   Valid CSS!   Creative Commons by nc sa 3.0   Hacker Ideals Emblem   Author Ian! D. Allen