Explains how to use active content in apache web servers -


Part -1:

Instructions: This lab provides you with experience in loading Apache in Fedora and Windows Server 2008. It also provides you with experience in installing Internet Information Services (IIS) Server in Windows Server 2008. This lab has three parts: installing Apache on Fedora, installing Apache in Windows Server 2008, and adding IIS to Windows Server 2008 as a role. Complete all three parts of this lab and attach this worksheet to your assignment when it is completed.

Part A, Installing Apache in Fedora.

Installing Apache in Fedora is a straight forward process that can be easily done in a few minutes. Since Apache can be installed anywhere in the Fedora file system, we'll do this first install in the lab1user's home directory.

Do the following steps to download the current version of Apache to Fedora.
1. Start your Fedora virtual machine and log into Fedora using the lab1user account that you created during the install process.
2. Open your browser and navigate to https://httpd.apache.org/download.cgi.
3. Locate the link for httpd-2.4.9.tar.gz and click on it. You will be prompted to open or save the file.
4. Verify that the Save File radio button is selected and click OK. The file will download to the /home/lab1user/Downloads directory on your Fedora virtual machine.
5. From the browser, right click on the [MD5] link to the right of the link for the file you just downloaded. Select the Save Link As... option on the menu that displays. You will be prompted to save the file as httpd-2.4.9.tar.gz.md5 in the Downloads folder.
6. Click Save. The MD5 hash file will be saved in the Downloads folder.
7. Minimize your browser, open a command prompt, and navigate to the /home/lab1user/Downloads folder.
8. Enter the following command: md5sum -c httpd-2.4.9.tar.gz.md5. If the file downloaded without errors, the md5sum command will return the following message: httpd-2.4.9.gz.md5: OK.
9. Enter the following command: tar -xzf httpd-2.4.9.tar.gz -C /home/lab1user . The tar command will create a directory called /home/lab1user/httpd-2.4.9 and extract the files to it.
10. If all of the steps completed successfully, you should be able to see the apache files in the /home/lab1user/httpd-2.4.9 directory.
Do the following steps to compile and install the current version of Apache in Fedora.
1. Verify that Apache is not already running by maximizing your browser, typing https://localhost/ in the Address text box, and pressing Enter. If you get a page not found error, Apache is not running. If you get a web page, Apache is running and you will need to shut it down using the procedures found in the Course Documents area of this course.
2. Maximize the command screen. At the command prompt type the following command and press Enter: su -. Remember to include the dash. You will be prompted for the root account password.
3. Type the password for the root account and press Enter. You will be logged in as root.
4. At the root command prompt, type the following command:

yum install gcc apr apr-devel apr-util apr-util-devel pcre pcre-devel

and press Enter. The yum installer will begin installing the compiler that will be used to compile Apache. After a short while, you will be prompted to answer if the installation is OK.
5. Type y each time you are prompted and press enter. After a short while, the installer will complete the installation of the specified modules and then return you to the command prompt.
6. Type exit and press Enter. This will log you out of root and return you to the user prompt.
7. At the user command prompt, change directory to /home/lab1user/httpd-2.4.9.
8. Type ./configure -prefix=/home/lab1user/apache/. This sets the installation directory for Apache.
9. Type make. After a few minutes, the make command will complete.
10. Type make install. After a few minutes the make install command will complete.
11. Type su - and press Enter. You will be prompted for the root account's password.
12. Type the password you gave the root account during installation. You will be presented with a root prompt (the pound sign).
13. Type /home/lab1user/apache/bin/apachectl start and press Enter. The Apache service will start.
14. Type exit and press Enter. You will return to the user prompt.
15. Change the permissions to read and execute for the group and others for the lab1user directory by typing chmod 755 /home/lab1user at the command prompt and pressing Enter.
16. Change the permissions to read and execute for the group and others for the apache directory by typing chmod 755 /home/lab1user/apache at the command prompt and pressing Enter.
17. Change the permissions to read and execute for the group and others for the htdocs directory by typing chmod 755 /home/lab1users/apache/htdocs at the command prompt and pressing Enter.
18. At the command prompt, type exit and press Enter. The command screen will close and you will return to your desktop.
19. Verify that Apache is running by maximizing your browser, typing https://localhost/ in the Address text box, and pressing Enter. If you get a web page, Apache is running.
20. Maximize the Oracle VirtualBox VM Manager and verify that the Apache Web page is visible in the Preview window.
21. Left click on the title bar to select it, press and hold the Alt key, and press the PrtScn key. Windows will create a screen shot of the VM Manager. Note: The screen shot should be of the VM Manager, not the virtual machine itself. Windows has difficulty making screen shots of virtual machines.
22. Paste the screen shot here:
23. Close the Fedora 14 virtual machine. When prompted, click the Save State radio button to save the current state of the machine.
Part B, Installing Apache on Windows Server 2008.
Do the following steps to install the current version of Apache on Windows Server 2008.
1. Start you Windows Server 2008 virtual machine and log in as an administrator.
2. Open Internet Explorer and navigate to https://www.apache.org/dist/httpd/binaries/win32/. Click on the link to httpd-2.4.9-win32-x86-openssl-0.9.8o.msi. You will be prompted to open or save the file.
3. Select a location to save the file and click on Save. The file will download to the location you have selected.
4. Navigate to the location where you saved the file. Double click on the file name to open it. The Apache Installation Wizard welcome screen will display.
5. Click Next. The license screen will display.
6. Click the I accept the terms in the license agreement radio button and click Next. The Server Information screen will display.
7. We will use the same domain that the book uses in its example. Type alcpress.com in the Network Domain text box. Type www.alcpress.com in the Server Name text box. Type [email protected] in the Administrator's Email Address text box. Click Next. The Setup Type screen will display.
8. Verify that the Typical radio button is selected and then click Next. The Ready to Install the Program screen will display.
9. Click Install. The wizard will install Apache, and, after a few minutes, the Installation Wizard Completed screen will display.
10. Click Finish. The wizard will close and you will return to your desktop.
11. Open Internet Explorer and type https://localhost in the address text box. Verify that the browser displays the Apache Web page. If it does, then you successfully installed Apache.
12. Maximize the Oracle VirtualBox VM Manager and verify that the Apache Web page is visible in the Preview window.
13. Left click on the title bar to select it, press and hold the Alt key, and press the PrtScn key. Windows will create a screen shot of the VM Manager. Note: The screen shot should be of the VM Manager, not the virtual machine itself. Windows has difficulty making screen shots of virtual machines.
14. Paste the screen shot here:
Part C, Installing Internet Information Services (IIS) on Windows Server 2008.
Do the following steps to install the Internet Information Services IIS in Windows Server 2008. IIS is Microsoft's web server. Unlike Apache, it is designed to run only on Microsoft products. The latest version of IIS (IIS 7) is installed as a role in Windows Server 2008. To install it, we'll first disable the Apache service and then use the Add Roles snap-in to enable it.
1. Log into you Windows Server 2008 virtual machine as an administrator.
2. Click on Start->Administrative Tools->Services. The services snap-in will display.
3. Locate the Apache service in the list of services and right-click on it. Select Properties from the menu that displays.
4. Click on the Disable check box to disable the service and then click OK. Close the Services snap-in.
5. Open Internet Explorer and type https://localhost in the address text box. Verify that the browser doesn't display the Apache web page. If it does, then you were not successful in disabling the service.
6. Click on Start->Administrative Tools->Server Manager. The Server Manager snap-in will display.
7. Click on Add Roles under Customize this server. The Add Roles Wizard will open and a list of roles will display.
8. Locate Web Server (IIS) in the list of roles and click on the check box to the left of it to select it. Click Next. The Add features required for Web Server (IIS)? screen will display.
9. Click the Add Required Features button. The Select Role Services screen will display.
10. Click Next to accept the defaults. The install wizard will install IIS.
11. Close the Wizard. You will return to your desktop.
12. Maximize Internet Explorer and type https://localhost in the address text box. Verify that the browser displays the IIS welcome Web page. If it does, then you successfully installed IIS.
13. Maximize the Oracle VirtualBox VM Manager and verify that the IIS welcome Web page is visible in the Preview window.
14. Left click on the title bar to select it, press and hold the Alt key, and press the PrtScn key. Windows will create a screen shot of the VM Manager. Note: The screen shot should be of the VM Manager, not the virtual machine itself. Windows has difficulty making screen shots of virtual machines.

Part -2:

Instructions: This assignment explains how to use active content in Apache Web servers. Please complete the following steps and contact your instructor if you experience problems with it. This is a graded lab assignment. Make sure you attach the completed lab worksheet to your assignment.

I. Configuring Apache for Server-Side Includes

1. Using vi, open your /etc/httpd/conf/httpd.conf file.

2. Search for your Options directive (Options Indexes FollowSymLinks) in the file. You can search for a string in vi by typing a forward slash and then the string your are looking for. To search, you must be in command mode. If you are in insert mode, the forward slash will be entered as text. To return to command mode from insert mode, press the Escape key.

3. When you find the Options directive, modify it by adding Includes to it. When you are done, the directive should look like this:
Options Indexes FollowSymLinks Includes

4. Search for the two lines shown below:
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml

Remove the pound sign (#) that is in front of each line to uncomment it.

5. Go to the end of the file and add the following line:

XBitHack on

6. Search for the following line. If it exists, put a pound sign (#) in front of it to comment it out:

Include conf/extra/httpd-vhosts.conf

7. Save the file and exit vi.

8. At the command prompt, type apachectl restart and press Enter to restart Apache.

9. Using vi, create a file in the /var/www/html directory called ssi.html. Add the following html code to it



SSI Page


This file was last modified on



10. Save the file and exit vi.

11. Change the file permissions on the ssi.html file to read, write, and execute for the user and read and execute for the group and others by typing the following command at the command prompt and pressing Enter:

chmod 755 /var/www/html/ssi.html

12. Change the ownership for the ssi.html file to user apache and group apache by typing the following command and pressing Enter:

chown apache:apache /var/www/html/htdocs/ssi.html

13. Switch from the command line to the graphical user interface and invoke the Firefox browser. Type https://localhost/ssi.html in the address text box and press Enter. You should see a message on your screen that looks similar to this one:

This file was last modified on Friday, 28-Apr-2015 06:59:38 CDT

Please note that the date and time displayed in your message should be more current than the one shown above.

14. Return to your command prompt and use the vi editor to open the /var/www/html/htdocs/ssi.html file. Insert a line between the tag and the

tag. Type the following line in the space provided by the new line:

This will modify the date and time field to just display the date.


15. Switch back to the browser and refresh your page. Your message should change to the following:

This file was last modified on 10/28/11

Again, please note that the date displayed in your message should be more current than the one shown above.

16. Attach a screen shot here of your Web browser displaying the message from Step 15.

___________

II. Using Server Side Include (SSI) Programs

1. Switch to your terminal window and open /var/www/html/ssi.html. Edit the file so that it looks like this:



SSI Page






Save and exit the file.

2. Switch to your browser and got to https://localhost/ssi.html. You should see the directory utilization summary for your /var/www/html directory.

3. Switch back to your command line and open ssi.html using vi. Replace the line of code that contains the server side include statements with the following line:

4. Save and exit ssi.html.

5. Switch back to your Web browser and refresh it. You should see a one month calendar.

6. Switch back to your command line and open ssi.html using vi. Add the -3 parameter to cal:

7. Save and exit ssi.html.

8. Switch back to your Web browser and refresh it. You should see a three month calendar. Attach a screen shot of the three month calendar here:

_________________

9. Switch back to your command line and open ssi.html. Remove the SSI statement and replace it with the following two statements:

10. Switch back to your Web browser and refresh it. Record the model and speed of your processor that is displayed in the browser in the spaces provided below:

Model: ____________________
Speed: _____________________

III. Configuring Apache for CGI

1. Create the following directory:

/var/www/html/cgi-bin

2. Open the /etc/httpd/conf/httpd.conf file using the vi editor.

3. Search for the ScriptAlias directive and verify that is reads as follows:

ScriptAlias /cgi-bin/ " /var/www/html/cgi-bin"

If it reads differently than the one above, edit it. If it doesn't exist, add it to the DocumentRoot container.

4. Locate the list of installed modules in httpd.conf and verify that the following module is in the list:

LoadModule cgi_module modules/mod_cgi.so

If it is not, add it to the list of modules.

5. Scroll to the end of the httpd.conf file and create a Directory container for the scripts directory:


Options +ExecCGI
AllowOverride None
Order allow,deny
Allow from all

6. Save your changes and exit the httpd.conf file.

7. Restart Apache using the apachectl restart command.

8. Navigate to /var/www/html/cgi-bin.

9. Using the vi editor, create a file in that directory called abc.sh and add the following lines of bourne again shell script code:

#!/bin/bash
echo "Content-Type: text/html"
echo
echo ‘

'
set
echo ‘

10. Save the file and exit the editor.

11. Type the following command at the command prompt and press Enter to set the owner and group of the file to daemon (the Apache user):

chown apache:apache /var/www/html/cgi-bin/abc.sh

12. Type the following command at the command prompt and press Enter to set the file permissions to read, write, and execute for the user and read and execute for the group, and others:

chmod 755 /var/www/html/cgi-bin/abc.sh

13. Switch to your Web browser and enter the following URL into the address text box:

https://localhost/cgi-bin/abc.sh

The browser will display a list of environment variables.

14. Switch to the command line and open the abc.sh file using the vi editor. Remove the set
Command in the fifth line of the file and replace it with the following two lines of code:

echo "Remote Host: $REMOTE_HOST"
echo " Remote IP: $REMOTE_ADDR:$REMOTE_PORT"

15. Switch to your Web browser and refresh the page. You will see the host name, IP address, and remote port number of your Web browser. Enter that information in the spaces provided below:

Host name: _____________________________________

IP address: _____________________________________

Port number: _____________________________________

16. Switch to the command prompt. Type the following command and press Enter:

yum install perl mod_perl

17. Use the vi editor to create a file called abc.pl in your /usr/local/apache/cgi-bin directory. Enter the following perl code in the file:

#!/usr/bin/perl
print << "FINISH1";
Content-Type: text/html


FINISH1
foreach $key (sort keys(%ENV)) {
print "$key = $ENV{$key}
";
}
print << "FINISH2";


FINISH2

Note: You must include the blank line after the Content-Type line.

18. Save the file and exit the editor.

19. Type the following command at the command prompt and press Enter to set the owner and group of the file to daemon (the Apache user):

chown apache:apache /var/www/html/cgi-bin/abc.pl

20. Type the following command at the command prompt and press Enter to set the file permissions to read, write, and execute for the user and read and execute for the group, and others:

chmod 755 /var/www/html/cgi-bin/abc.pl

21. Switch to your Web browser and enter the following URL in the address text box:

https://localhost/cgi-bin/abc.pl

IV. Verify that the PHP module is still working

1. Open a terminal on your Fedora machine and log in as root.

2. Create a file called test.php in /var/www/html. Add the following code to it:





Save and exit the file.

3. Switch to your desktop and open the browser. Type the following string into the address text box and press Enter:

https://localhost/test.php

You should see a page that displays Welcome to my PHP Web Page.

Solution Preview :

Prepared by a verified Expert
Application Programming: Explains how to use active content in apache web servers -
Reference No:- TGS01156555

Now Priced at $150 (50% Discount)

Recommended (93%)

Rated (4.5/5)

A

Anonymous user

5/9/2016 2:21:19 AM

In the above programming problem illustrated above, I score A+ grade for the assignment work. This is because I got the assistance from the best panel of experts of this site. They provide me the best possible solution including all the programming files and requisite snapshots to better comprehend the assignment work. Thanks and i will definitely suggest mu mates to get assistance from you.