• No results found

Confirm that Apache is working, by pointing a browser on host03 to http://localhost

In document D90758GC10_ag1 (Page 100-107)

Practices for Lesson 5: Overview

Practice 5-1: Configuring the Apache Web Server

2. Confirm that Apache is working, by pointing a browser on host03 to http://localhost

a. On the GNOME menu bar, click “Applications” to view the drop-down menu.

• Under “Favorites,” select the “Firefox Web Browser” icon to start the Firefox web browser.

b. Enter http://localhost in the browser and press Enter.

• The Apache Test Page appears and confirms that Apache is working correctly.

c. Close the Firefox web browser by clicking the “X” in the top-right corner of the window. • A “Confirm close” dialog box might appear. If so, click the “Close tabs” button to

close the window.

3. Create and view a test webpage.

a. Use the vi editor to create the /var/www/html/index.html file with the following entry:

# vi /var/www/html/index.html

<html><body><p>This is my test page.</p></body></html>

juan corso arias (juanฺcorso@unimilitarฺeduฺco) has a

non-transferable license to use this Student Guideฺ

b. Restart the Firefox browser and point to http://localhost.

• The test webpage appears.

c. Close the Firefox web browser by clicking the “X” in the top-right corner of the window. 4. Create a virtual host on the Apache web server and name it www.example1.com.

a. Use the vi editor to edit the /etc/httpd/conf/httpd.conf file to add the following entries to the end of the file:

# vi /etc/httpd/conf/httpd.conf <VirtualHost *:80> ServerName www.example1.com DocumentRoot /var/www/example1 ErrorLog /var/log/httpd/example1.error_log <Directory /var/www/example1> Order deny,allow Deny from all Allow from 192.0.2

</Directory> </VirtualHost>

b. Use the vi editor to edit the /etc/hosts file and append www.example1.com to the

192.0.2.103 entry as follows: # vi /etc/hosts

192.0.2.103 host03.example.com host03 www.example1.com

juan corso arias (juanฺcorso@unimilitarฺeduฺco) has a

non-transferable license to use this Student Guideฺ

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 5: Web and Email Services

c. Use the mkdir command to make the /var/www/example1 directory. # mkdir /var/www/example1

d. Use the cp command to copy the /var/www/html/index.html file to the /var/www/example1 directory.

# cp /var/www/html/index.html /var/www/example1/

e. Use the vi editor to edit the /var/www/example1/index.html file as follows: # vi /var/www/example1/index.html

<html><body><p>This is my test page for

www.example1.com.</p></body></html>

f. Use the apachectl configtest command to check the configuration file for possible errors.

• In this example there are no errors. • Fix any errors you might have made.

# apachectl configtest Syntax OK

g. Use the apachectl graceful command to reload the configuration without affecting active requests.

# apachectl graceful

juan corso arias (juanฺcorso@unimilitarฺeduฺco) has a

non-transferable license to use this Student Guideฺ

5. View the test webpage for www.example1.com.

a. Restart the Firefox browser and point to http://www.example1.com.

• The test webpage for www.example1.com appears.

b. Close the Firefox web browser by clicking the “X” in the top-right corner of the window. 6. Create a second virtual host on the Apache web server named www.example2.com.

a. Use the vi editor to edit the /etc/httpd/conf/httpd.conf file to add the following entries to the end of the file:

# vi /etc/httpd/conf/httpd.conf <VirtualHost *:80> ServerName www.example2.com DocumentRoot /var/www/example2 ErrorLog /var/log/httpd/example2.error_log <Directory /var/www/example2> Order deny,allow Deny from all Allow from 192.0.2

</Directory> </VirtualHost>

juan corso arias (juanฺcorso@unimilitarฺeduฺco) has a

non-transferable license to use this Student Guideฺ

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 5: Web and Email Services

b. Use the vi editor to edit the /etc/hosts file to append www.example2.com to the

192.0.2.103 entry as follows: # vi /etc/hosts

192.0.2.103 host03... www.example1.com www.example2.com c. Use the mkdir command and make the /var/www/example2 directory.

# mkdir /var/www/example2

d. Use the cp command to copy the /var/www/example1/index.html file to the /var/www/example2 directory.

# cp /var/www/example1/index.html /var/www/example2

e. Use the vi editor to edit the /var/www/example2/index.html file as follows: # vi /var/www/example2/index.html

<html><body><p>This is my test page for www.example2.com.</p></body></html>

f. Use the apachectl configtest command to check the configuration file for possible errors.

• In this example there are no errors. • Fix any errors you might have made.

# apachectl configtest Syntax OK

g. Use the apachectl graceful command to reload the configuration without affecting active requests.

# apachectl graceful

juan corso arias (juanฺcorso@unimilitarฺeduฺco) has a

non-transferable license to use this Student Guideฺ

7. View the test webpage for www.example2.com.

a. Restart the Firefox browser and point to http://www.example2.com.

• The test webpage for www.example2.com appears.

b. Close the Firefox web browser by clicking the “X” in the top-right corner of the window.

juan corso arias (juanฺcorso@unimilitarฺeduฺco) has a

non-transferable license to use this Student Guideฺ

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 5: Web and Email Services

8. Log off from host03.

a. Click the “Oracle Student” in the top-right corner of the GNOME desktop to display the drop-down menu.

b. Select “Log Out” from the menu. • The following window appears.

c. Click “Log Out.”

d. Close the VNC window by clicking the “X” in the top-right corner of the window.

juan corso arias (juanฺcorso@unimilitarฺeduฺco) has a

non-transferable license to use this Student Guideฺ

Practices for Lesson 6:

In document D90758GC10_ag1 (Page 100-107)