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 : /nginx/html/JimMartinson/CST1611/Labs/LabHostSetup/ |
Upload File : |
<? // JimMartinson/CST1611/Labs/LabHostSetup.phpinc $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. include('application.phpinc'); include('Course/courseInfo.phpinc'); include('../../classInfo.phpinc'); require('Gradebook/EvaluationSubmission_BEGIN_folders.phpinc'); $ht = formValue('ht',''); // Host name. $ha = formValue('ha',''); // Host IP address. $vh = formValue('vh',''); // Virtual Host ServerName. $ip = formValue('ip',''); // Virtual Host IP address. $pt = formValue('pt',''); // Virtual Host port. $dr = formValue('dr',''); // Virtual Host DocumentRoot and Directory. $au = false; //formValue('au',''); // Show short filenames. $lg = formValue('lg',''); if ( !$lg ) $lg = $vh; // Virtual Host log file base name. $nc = formValue('nc',''); // Skip adding comment line. $nv = formValue('nv',''); // Skip Virtual Host verification. #if ( $ha == '' ) $ha = '127.0.0.1'; if ( $vh ) { $hn = $vh; } else { $hn = $ip; } if ( $pt ) $hn .=':'.$pt; $df = formValue('df',''); // Directory file name. If not set it will become: '!'.$evaluationName.'-'.$userFullName.'.txt'. $evaluationTitle = "Setup a "; if ( $ht ) { $evaluationTitle .= "host entry "; if ( $vh ) $evaluationTitle .= "and a "; } if ( $vh ) $evaluationTitle .= "Virtual Host"; $assignmentPoints = 10; $assignmentWeekDue = 10; $title = $evaluationType." ".$evaluationNumber.' - '.$evaluationTitle; $headTitle = '_CST_ - '.$courseNumber.' '.$courseTitle.' - '.$title; $pageTitle = $courseNumber.' '.$courseTitle.'<br>'.$title; $pageMenu = 'Course/courseMenu.phpinc'; $smallTitle = true; include('common/pageHeader.phpinc'); $f_uId = formValue('uId'); if ( $f_uId ) { $userId = $f_uId; $userFullName = userName($userId); } else { $userFullName = $_SESSION['userFullName']; $userId = $_SESSION['userId']; } $userFileName = str_replace(" ","",$userFullName); $sectionTitle = $evaluationTitle; include('common/sectionHeader.phpinc'); $ShowSpanCountBefore = false; if ( !$df ) { $directoryFile = '!You are in the '.fileSafe($userFullName).' '.$evaluationName.' directory.txt'; } else { $directoryFile = $df; } //$ShowSpanCountBefore = true; // <span class="count"> ?> <style type="text/css"> b { white-space:nowrap; } ol { } li { } ol.count { counter-reset:item; } ol.count ol { counter-reset:item; } ol.count li.count { list-style-type:none; } ol.count li.count:before { content:counters(item, ".") ". "; counter-increment:item; margin-left:-2em; } <? 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> <ol id="main" class="count"> <? if ( $ht && $ha ) { ?> <li>Setup a host entry for use in <?=$evaluationType?> <?=$evaluationNumber?>. <ol> <li>Open your <b>hosts</b> file in a text editor.</li> <li>At the bottom of the hosts file add the following lines: <br><pre class="samp copyText"># <?=$ht?><? echo "\n"; ?> <?=$ha?> <?=$ht?></pre> </li> <li>Save your changes.</li> </ol> </li> <? } ?> <? if ( $vh || $ip ) { ?> <li>Setup a <? if ( $vh ) { ?>Name<? } else { ?>IP<? } ?>-based Virtual Host for use in <?=$evaluationType?> <?=$evaluationNumber?>. <ol> <li>Create a <? if ( $vh ) { ?>Name<? } else { ?>IP<? } ?>-based VirtualHost <b><?=$vh?></b><? if ( $pt ) { ?> on port <?=$pt?><? } ?> using the <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=str_replace("/","\\",$dr)?></b> directory. <ol> <li>Edit your Apache config. <? if ( !$nc ) { ?>At the bottom of the file add the comment: <comment class="copyText"># <?=$evaluationName?></comment>. Place all your work for this lab below this comment unless otherwise directed.<? } else { ?>Place all your work for this part of the lab at the bottom of the file unless otherwise directed.<? } ?></li> <li>Copy the these VirtualHost directive lines: <br> <pre class="code copyText"><VirtualHost *> <tt>DocumentRoot</tt> <samp>path_to_document_root</samp> <? if ( $vh ) { ?> <tt>ServerName</tt> <samp>server_name</samp><? echo "\n"; } ?> <tt>ErrorLog</tt> <samp>logs/log_name.Error.log</samp> <tt>CustomLog</tt> <samp>logs/log_name.Access.log common</samp> <Directory <samp>path_to_document_root/</samp>> <tt>Options</tt> <samp>All +MultiViews</samp> <tt>AllowOverride</tt> <samp>All</samp> <tt>Require</tt> <samp>all granted</samp> </Directory> </VirtualHost></pre> </li> <li>Modify the lines so that: <ol> <? if ( $ip ) { ?> <li>The <code>VirtualHost</code> IP address is <code class="copyText"><?=$ip?></code>.</li> <? } ?> <? if ( $pt ) { ?> <li>The <code>VirtualHost</code> port is <code class="copyText"><?=$pt?></code>.</li> <? } ?> <li>The <tt>DocumentRoot</tt> is <samp class="copyText"><?=$apacheFolder?>/<?=$courseNumber?>/<?=$dr?></samp>.</li> <? if ( $vh ) { ?> <li>The <tt>ServerName</tt> is <samp class="copyText"><?=$vh?></samp>.</li> <? } else { ?> <li>Remove the <tt>ServerName</tt> directive.</li> <? } ?> <li>The <tt>ErrorLog</tt> is <samp class="copyText">logs/<?=$lg?>.Error.log</samp>.</li> <li>The <tt>CustomLog</tt> is <samp class="copyText">logs/<?=$lg?>.Access.log common</samp>.</li> <li>The <code>Directory</code> is <samp class="copyText"><?=$apacheFolder?>/<?=$courseNumber?>/<?=$dr?>/</samp>.</li> </ol> </li> <li>Save your changes.</li> <? if ( !$nv ) { ?> <li>Verify the <code>VirtualHost</code> works. <ol> <li>Restart Apache.</li> <li>Open up a browser.</li> <li>Enter <b>http://<? if ( $vh ) { echo $vh; } else { echo $ip; } ?></b> in the address bar and hit enter. You should see a page similar to: <? include('common/Browser/Browser.phpinc'); BrowserBegin('Index of /','http://'.$hn.'/',600); ?> <h1 style="text-align:left;">Index of /</h1> <? if ( $au ) { ?> <table class="times"> <tr> <th></th><th class="center"><a href="?C=N;O=D">Name</a></th><th class="center"><a href="#">Last modified</a></th><th class="center"><a href="#">Size</a></th><th class="center"><a href="#">Description</a></th> </tr> <tr> <th colspan="5"><hr></th> </tr> <tr> <td valign="top"><img src="../unknown.gif" alt="[ ]"></td><td><a href="#"><?=substr($directoryFile,0,20).'..>'?></a></td><td class="right"><?=date('d-M-Y')?> <?=date('H:i')?></td><td class="right">0</td> </tr> <tr> <th colspan="5"><hr></th> </tr> </table> <? } else { ?> <ul type="disc"> <li><a href="#"><?=$directoryFile?></a></li> </ul> <? } ?> <br> <? BrowserEnd(); ?> </li> </ol> </li> <? } else { ?> <? } ?> </ol> </li> </ol> </li> <? } ?> </ol> </fieldset> <? #include('../../ReferencesResources.phpinc'); include('common/sectionFooter.phpinc'); include('common/pageFooter.phpinc'); if ($TRACK != '') $_SESSION['TRACK'] .= "<li>End ".basename(__FILE__)."</ol>\n"; ?>