% Student Web Site -- Student Photo % Ian! D. Allen -- -- [www.idallen.com] % Fall 2017 - September to December 2017 - Updated 2017-12-12 12:42 EST - [Course Home Page] - [Course Outline] - [All Weeks] - [Plain Text] Create your own course web site =============================== 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/17f/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]. 7. Edit the `index.html` file to put your own information in it: a. Replace all occurrences of the userid `abcd0001` with your own Algonquin userid. b. Replace **all** occurrences of the two words `Your Name` with your own name. (*Replace all of them!*) c. *VIM can do these changes instantly with a substitute command.* 8. 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` 9. 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]. Choose your Privacy settings ============================ 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]. Open access to the world: allow everyone, everywhere on the Internet -------------------------------------------------------------------- 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. Access Controls: Restricted access to your site: you choose the sites --------------------------------------------------------------------- > 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]. ### Example Restricted Access `.htaccess` file 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]. To upload an image file to your site ==================================== 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` 3. Copy the file `~idallen/cst8207/17f/cgi-bin/upload.html` into the current directory. Make sure the file is readable by others. ### `upload.cgi` 4. Copy the file `~idallen/cst8207/17f/cgi-bin/upload.cgi` into the current directory. Make sure the file is readable and executable by others. 5. Edit file `upload.cgi` and add an upload password to the file. (Follow the instructions in the file.) 6. Make sure `Options +ExecCGI` is set in your `.htaccess` file. 7. 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! 8. Use the **Browse** button to find on your computer an image to upload. 9. Enter your upload password in the Password box. (This is the same password you entered as `PASSWORD=` in your `upload.cgi` file.) 10. 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! Upload a head-shot picture of you: `me.jpg` =========================================== > 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] 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.) The head shot should show your face clearly. 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 size should be less than 1 MB. The file must be a JPEG format image named `me.jpg` and must be in your `public_html` directory. (You can always rename a file on the CLS after you have uploaded it.) The file must have "other" read permission. Class Photo Montage =================== A clickable public montage of all the uploaded head-shot pictures is available at 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 `montage17f.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/montage17f.cgi` Errors, Troubleshooting, and Logs ================================= 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: - Apache error log: `/var/log/apache2/error.log` - CGI (suexec) log: `/var/log/apache2/suexec.log` 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**. -- | 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 [www.idallen.com]: http://www.idallen.com/ [Course Home Page]: .. [Course Outline]: course_outline.pdf [All Weeks]: indexcgi.cgi [Plain Text]: 000_student_web_site.txt [Course Linux Server]: 070_course_linux_server.html [Errors, Troubleshooting, and Logs]: #errors-troubleshooting-and-logs [Apache Access Controls]: http://httpd.apache.org/docs/2.2/howto/access.html [head shot]: http://en.wikipedia.org/wiki/Head_shot [Pandoc Markdown]: http://johnmacfarlane.net/pandoc/