Sie sind auf Seite 1von 3

HET306/HIT8163 - Unix for Telecommunications Lab Handout - Basic Apache

Unix for Telecommunications


Laboratory Handout – Basic Apache

I. I NTRODUCTION
In this lab you will learn about the Apache web server application. You will perform some basic configuration of your
RULE host to provide web services using Apache.

II. P REPARATION
You can prepare for this lab by reading some of the Apache documentation available at http://httpd.apache.org. You should
also review the basic concepts of:
• TCP
• TCP Port Numbers
• Allocated/default TCP Port Number Allocation
• The HTTP Protocol

III. M ETHODOLOGY
A. Apache Introduction
1) Apache has already been installed on your rule host, it would typically be installed under FreeBSD using ports. Locate
the port installation directory under FreeBSD on your RULE host
2) Have a look at the /etc/services file. What do you think Unix uses this file for?

B. Apache Configuration File


1) Have a look at the Apache configuration file in /usr/local/etc/apache22 (you do not have to understand all of
the options in this file)
• What port will Apache run on when started?
• What directory from your RULE host will be served?
• Locate where the error log and access log will be written to

C. Installing a Simple Web Page


1) Create some basic content for the Apache Server to serve. At a minimum this should include:
• An index.html file
• An image (eg. from http://www.freebsd.org/art.html
• Your name and student ID somewhere on the web page
2) Install your generated content into the directory you previously discovered would be served by Apache

D. Starting Apache
1) Run
sockstat -4
and note the output
2) Start Apache using the command
apachectl -k start
3) Rerun
sockstat -4
What does the output mean?
4) Access your new web site by browsing to your RULE host from one of the lab computers (Note: It is recommended not
to use Internet Explorer due to it’s caching behaviour)
5) Look at your httpd-access.log file
• What is in this file?
• What do each of the lines mean?
• What does each field on each line represent?
6) Access a web page on the server (from the browser) that does not exist
• Where can you find information about what went wrong?

Aug 2009 (v5) page 1


HET306/HIT8163 - Unix for Telecommunications Lab Handout - Basic Apache

E. Simple Authentication
1) Use the web to research the contents of the .htaccess file. What are some of the things you can configure with
.htaccess
Hint: a good place to start is http:// www.javascriptkit.com/ howto/ htaccess.shtml
2) Create a sub-directory in the Apache served directory (where you put your web site) called private
3) Create and install some more content in the private directory
Hint: It is helpful to make sure this is slightly different than your original web site
4) Edit the section in httpd.conf that refers to serving your web site
• Change the line that reads “AllowOverride None” to “AllowOverride All”
• Restart Apache
• Create a .htaccess file in the private directory with the following content:

AuthUserFile /usr/local/www/.htpasswd
AuthGroupFile /dev/null
AuthName EnterPassword
AuthType Basic

require user ruleperson

5) Why do we store the password file in the specified directory?


6) Create the password file by executing
htpasswd -c /usr/local/www/.htpasswd
7) Determine what this command does by running
man htpasswd
8) Browse to the private folder on your web site http://ruleXX.caia.swin.edu.au/private – note that this should result in
an actual web page rather than a directory listing of the web folder
9) What have you achieved? – or should have achieved

F. Automatically Starting Apache at System Boot


1) Once a service is properly configured and running, we often want to:
• Start it automatically at boot-time, in case the system is rebooted for whatever reason
• Enable starting/stopping/restarting the service via the use of the rc scripts – this simplifies the procedure and ensures
that any dependent are also started if required
2) To configure both these tasks you need to edit the /etc/rc.conf file and add the line:
apache22_enable="YES"
3) You will now be able to start and stop apache using the command:
/usr/local/etc/rc.d/apache22 <start|stop>
Note: You will have to stop the apache server using apachectl before using the rc scripts

IV. L AB R EPORT
If this lab has been marked as assessable you will be required to submit a lab report of no more than three pages in length.
The lab report should be formatted using the IEEE conference style template in two column mode. In the report you should
include:
• A discussion of the /etc/services file and where the Apache port (for installation) is located
• Answer the questions from Part B of the Lab
• A discussion on the output of the sockstat command
• A discussion of the contents of the log files
• A discussion on the procedure of enabling simple authentication to access the private folder and answering the questions
raised in this part of the Lab

V. A SSESSMENT
If this lab has been marked as assessable then the ten marks available for this lab are allocated as follows.

Aug 2009 (v5) page 2


HET306/HIT8163 - Unix for Telecommunications Lab Handout - Basic Apache

Component Score
System Config
Apache running on server on port 80 1
Basic (main) web page successfully served 1
Private page cannot be downloaded without authentication 1
Private page can be downloaded with a provided username/password of 1
(ruleperson/ruleperson)
Lab Report
Quality and Completeness 6
Total 10
If the lab has been marked as non-assessable then your lab will be noted as being successfully completed if all the tests
have been successfully passed.

VI. P LAGIARISM
Please be aware of Swinburne’s plagiarism policies and procedures:
• http://www.it.swin.edu.au/students/plagiarism guide.pdf
part of this is citation of work, a guide is available at:
• http://www.swin.edu.au/lib/guides/harvard system.pdf

VII. FAILURE TO HAND IN LABS


The automatic marking script will analyse your RULE host for proper completion of lab instructions at the specified time.
If your RULE host does not pass the automated testing procedure your lab will be marked as incomplete. Please be aware
that four out of the six non-assessable labs must be successfully completed. Note: Not all labs involve an automated marking
script, where this is the case, an alternate means of submitting the lab is outlined in the report above.
If this lab has been designated as one of the four assessable labs, then it must be submitted using the Faculty ESP web
site (https://esp.ict.swin.edu.au. An assessable lab is worth 5% of your final mark. Late submissions will be subject to a 10%
penalty of the total marks available for each working day late (0.5%) up to a maximum of five working days.
You may run the automated marking script yourself via the provided web-site as listed on Blackboard (http://blackboard.
swin.edu.au). If the lab is:
• Non-assessable – You will be informed on the pass/fail status of your rule host
• Assessable – You will be informed of the final score for this lab that is apportioned to lab work as opposed to the required
lab report
Having home network connection problems (including VPN issues) is not considered an excuse for late, or non-submission.
Email submission of labs will not be accepted. Make sure that you setup and test your VPN access of both RULE and the
CSG website before relying on VPN access to submit work.

VIII. A FTER LAB HRS ACCESS TO RULE SYSTEM


The RULE system can be accessed from any computer on Swinburne’s internal network using appropriate ssh client software
(such as PuTTY). For access from outside of Swinburne’s network the following links will help:
Connection to Swinburne’s internal network via the Internet:
http://www.its.swin.edu.au/networks/vpn/
Direct dial in to Swinburne using PPP:
http://www.its.swin.edu.au/student services/student guide/#PPP
Please note that configuring your home Windows based PC to use your DNS server running on the RULE host via the VPN
appears not to work. If anybody figures out how to set this up could you please let me know.

Aug 2009 (v5) page 3

Das könnte Ihnen auch gefallen