Linux Lab 8.pdf
Linux Lab 8.pdf
Linux Lab 8.pdf
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Faculty of ESBE<br />
Telecommunications & Internet Engineering<br />
Apache Server Configuration<br />
1. Now lets setup a web server. Fortunately, <strong>Linux</strong> ships with the apache web server that is preconfigured.<br />
Login as root, type the following to start the service:<br />
/etc/rc.d/init.d/httpd start<br />
2. Open your web browser to "http://". You should see a generic introduction web<br />
page.<br />
3. Change to /etc/httpd/conf/ folder.<br />
4. Make a backup of the Apache configuration file, “cp httpd.conf httpd.bak”.<br />
5. Check the Apache configuration file, “cat httpd.conf”, find out the information about MaxClients,<br />
Port, User, Group, ServerAdmin, ServerName, DocumentRoot, DirecotryIndex, ScriptAlias.<br />
6. Change the ServerName to www.pcx.telecommx.sbu.ac.uk.<br />
7. Change to DocumentRoot directory, rename the “index.html” file, “mv index.html index.bak”,<br />
write a your own “index.html” file which only display the hostname and IP address of the current PC.<br />
8. From your partner’s PC, open a web browser to your web site<br />
"http://www.pcx.telecommx.sbu..ac.uk".<br />
9. To execute CGI programs, open the Apache configuration file, “pico /etc/httpd/conf/httpd.conf”,<br />
within the section, add ExecCGI to the end of the line<br />
“Option Indexes Includes FollowSymLinks”.<br />
10.Create a HTML file containing following lines, and save it as “hello.html” in Apache DocumentRoot<br />
directory.<br />
<br />
School of EE&IE<br />
<br />
Welcome to PCx, Telecommx, CGI Test!<br />
<br />
<br />
<br />
<br />
<br />
11.Create a Perl CGI file containing following lines, and save it as “hello.pl” in Apache cgi-bin directory,<br />
and change mode to 755.<br />
#!/usr/bin/perl -w<br />
print "Content-type: text/html\n\n";<br />
print " ";<br />
print " Hello ";<br />
print " Hello $ENV{'REMOTE_HOST'}! ";<br />
print " ";<br />
exit;<br />
Dr. Perry XIAO Copyright © 2005, LondonSouth Bank University 1
Faculty of ESBE<br />
Telecommunications & Internet Engineering<br />
12.From your partner’s PC, open a web browser to your web site<br />
"http://www.pcx.telecommx.sbu..ac.uk/hello.html", click the “Hello!” button and test your CGI<br />
program, and write down the CGI output.<br />
13.To allow individual users to publish their own web site, logout of root, log in using your own<br />
username, in your home folder, make a sub-directory called “public_html”, change mode to 755,<br />
create a simple personal wet page containing only your name, course, and student number, save it as<br />
“index.html” under the “public_html” folder, change mode to 755.<br />
14.Logout and re-login as root, open the Apache configuration file, un-comment (i.e. delete the # sign in)<br />
all the lines within the section. Restart the httpd<br />
daemon program.<br />
15.From your partner’s PC, open a web browser to your web site<br />
"http://www.pcx.telecommx.sbu..ac.uk/~yourusername", does it work?<br />
16.Check the permission of your home folder, change mode to 755, redo step 15.<br />
17.Delete the “hello.html” and “hello.pl” files.<br />
18.Restore the “index.html” file, “mv index.bak index.html”.<br />
19.Restore the Apache configuration file, “mv /etc/httpd/conf/httpd.bak /etc/httpd/conf/ httpd.conf”.<br />
20.If you still have time, go to the KDE graphical interface by typing “startx”, and find out if there are<br />
any graphical equivalent programs for the above tasks.<br />
Questions:<br />
1. If each web service requires 1.2MB of RAM on the server, with the current setup of your PC,<br />
how many users can access your web site simultaneously without significantly slowing down the<br />
service?<br />
2. What is Perl?<br />
3. What is CGI programming?<br />
4. By default, “public_html” is your personal web folder, can you rename it something else? How?<br />
5. Can you run the “hello.pl” CGI program without going through “hello.html” file?<br />
6. What is the transmission rates of your Ethernet card and RJ45 Ethernet cable?<br />
Dr. Perry XIAO Copyright © 2005, LondonSouth Bank University 2