Lab3 Apache1 Home
Lab3 Apache1 Home
Nassar
Creating and Modifying an Apache Web Server Home Page In the next few labs we will be configuring a web site on our server. We will use Apache as the web server. We will set up ftp (file transfer protocol) to enable us to transfer files to the server from a remote location. We also will enable telnet to allow us to login remotely to configure the server. This lab assumes that your network card is working and you are using dhcp for an ip address. If you completed the installation lab correctly this should be true. Make sure that your network cable is connected, and you can browse the Internet using Mozilla (or Netscape). Note: If Internet access is not available in your classroom, you need to assign a static IP address. The lab does not require Internet access. Background info: A daemon is a server process (pronounced DEE-mun). It is constantly running and listens for client connections. The http daemon for Apache is httpd. The ftp daemon we will use is wu-ftpd (the Washington University ftp program). These server processes are also called services and they must be turned on. 1. We will start the services from the GNOME GUI. Go to start-ProgramsSystem-Service Configuration. Check the boxes for httpd, wu-ftpd, and telnet. You can also check the box for smb (samba) which we will use in a subsequent lab. By checking these boxes we are saying that we want our services to start whenever the server is rebooted. Were any of the boxes already checked? __yes______ Reboot the server. For me, the fastest way to shut down is by typing "init 0" in a terminal window. 2. Check to see the ip address that was assigned to you from the dhcp server. In the terminal window type ip address. What is your ip address? ___192.168.1.63_______ 3. Go into Mozilla and try to browse into your server. You can use http://your_ip_address or http://localhost. Can you see the home page? _yes____ Minimize Mozilla. Leave it running for the remainder of the lab.
4. Can you find the home page? It is in a subdirectory of /var. What is the directory name? ___html_______________ What is the file name? ____index.html_____________ 5. Rename the original home page to index.html.old using the method below:
In the terminal window change into the web root directory (if you are not there already). What command would you type? _____cd /var/www/html___________________ Use the move command: mv index.html index.html.old Minimize the Terminal Window. Leave it running for the remainder of the lab. 6. Create a new home page in gedit: <html> <!- - This is a comment. - - > <!- - Where it says Group x use the letter for your group - - > <h1>Group x Home Page</h1> </html> Save this in the web root directory as index.html. 7. Actually, you may have already created a page in the prior lab, so you could copy it. From the terminal window type: cp /home/student/my_files/page1.html /var/www/html/two.html
7. Create two more web pages in the same directory using gedit. Save as: three.html and four.html Put something different in each page so you can tell the difference. 8. Go into Mozilla and see if you can view each of the 4 pages. Can you see all 4 or just 1 ? ____yes___________ 9. Make a subdirectory inside of the web root directory: mkdir /var/www/html/archive
10. Create a web page in the archive directory called list.html. The page should have the word Archive in the heading. 11. Using ls -l , what are the permissions for the archive directory? (Number please) _644____ 12. What are the permissions for the list.html file? (Number please) _644____ Remember: to change directories from /var/www/html to /var/www/html/archive you type cd archive and to go back you type cd .. 13. Change the permissions for both the archive directory and the list.html file so that the owner has full control, and groups and other can read only. What chmod commands did you type? Chmod 744 /var/www/html/archive__________________ __________________ 14. Use ls -al to make sure that your permissions are correct. What permissions do you see listed for "archive"? (Give letters, eg., rwx rw- r--) ____-rwxrr-____________ 15. Go into Mozilla and try to view the file: //localhost/archive/list.html Can you see it? _no______ What message do you get? (Write the full message below) ______the file cannot be found. Please check the location and try again_____________________________________________ ___________________________________________________ ___________________________________________________ 16. Change the permissions for "archive" from 744 to 711. What command did you type? Chmod 711 /var/www/html/archive_________________ 17. Can you view the file now? _yes_____ 18. What does 711 mean? (in words) _____It means that users have access to the file______________________________________________ ___________________________________________________ ___________________________________________________ 19. Change the permissions for archive from 711 to 755. What command did you type? chmod 755 /var/www/html/archive___________________
20. Can you view the file now? _755_____ 21. What does 755 mean? (in words) ___the owner has complete control and the other and group can only read and execute________________________________________________ ___________________________________________________ ___________________________________________________ 22. What permissions are needed for a directory to enable web viewing? (Number please!) __5________ 23. What permissions are needed for a file to enable web viewing? (Number please!) ___4_______ 24. In Mozilla browse to //localhost/archive/ Do not type in the file name, but make sure there is a slash at the end. What is displayed? _________________________ 25. In the terminal window, rename the list.html file as index.html. Use the mv command. What command did you type? ________________________ 26. As in step 24, browse to //localhost/archive/ _________________________ What is displayed now?
25. Explain why the answers to questions 24 and 26 are different. ___________________________________________________ ___________________________________________________ ___________________________________________________ 26. In the terminal window shut down the server: init 0