[SOLVED] WEB375 LAB 5 CONFIGURE HTTP SERVER IN LINUX: The purpose of this Lab is to configure an Apache web server in Linux. Use the IP addresses that exist when you start Linux.
Virtual Machine Login Information for PLABFED01 and PLABFED02
Username: Student
Password: Password
Username: root
Password: Password
[SOLVED] WEB375 LAB 5 CONFIGURE HTTP SERVER IN LINUX: Lab Diagram
During your session, you will have access to the following Lab configuration.
WINCONSOLE PLABFED01 PLABFED02
The Linux servers also connect to a private network. The IP address of PLABFED01 is 192.168.240.11 and the IP address of PLABFED01 is 192.168.240.12.
Connecting to Your Lab
In this module, you will be working on the following equipment to carry out the steps defined in each exercise.
Each exercise will detail which console you are required to work on in order to carry out the steps.
To start, simply click on the named server from the device list (located on the left hand side of the screen) and click the Power on from the Tools bar. In some cases, the devices may power on automatically.
During the boot up process, an activity indicator will be displayed in the Name tab:
If the remote console is not displayed automatically in the main window (or popup), click the Connect icon located in the Tools bar to start your session.
If the remote console does not appear please try the following option:
In the event this does not resolve your connectivity problems, please visit our Help / Support pages for additional resolution options.
[SOLVED] WEB375 LAB 5 CONFIGURE HTTP SERVER IN LINUX: TASK A – Read General Background Information on HTTP Server
This is the background information to help you do your lab. Read this to get a general understanding of how to configure an HTTP server.
Apache Web Server Overview
What Is a Web Server?
A web server uses the Hypertext Transfer Protocol (HTTP) to communicate or distribute static or dynamic information from a central computer. In addition, many web servers also:
What is Apache?
The most popular web server on the Internet is Apache; it is open source. Apache is stable, relatively secure, and can be customized with added functionality with dynamic modules loaded on the fly when they are needed.
Become Familiar with Apache Files
The root directory of the web server is /etc/httpd, which is divided into three parts:
The main file, httpd.conf, is used to configure a web server. It contains the configuration directives that give the server its instructions. The configuration directives are grouped into three basic sections:
The following table lists some directives and their meaning:
ServerRoot The server installation / configuration location
ScoreBoardFile Where the Apache server stores some of its own process information
Port Which port the server listens on
ServerAdmin Administrator’s E-mail address
ServerName Host name / IP address of the machine running the server
DocumentRoot This is the location where your HTML documents are stored
DirectoryIndex List of HTML document file names
ServerType Select “standalone” or via xinetd
LoadModule To load the specified module
[SOLVED] WEB375 LAB 5 CONFIGURE HTTP SERVER IN LINUX: TASK B – Configure Basic Settings For The Web Server Step-By-Step
We start setting up a basic HTTP server. As always when doing any type of system administration, we need to perform them using root account. Use Putty to logon plabfed01 as root.
Step 1: To stop all firewalls or security features, type the following commands:
#systemctl stop firewalld
#systemctl stop iptables
Step 2: Make sure Apache is installed by typing the following from a terminal window:
If it did not show as the above outputs, you need to install them. To install Apache on an Fedora 20 system type:
#yum –y install httpd
Step 3:
Now that the Apache packages are installed, we need to set the name of the web server to match with the name of the computer. Edit /etc/httpd/conf/httpd.conf, search for the line containing ‘ServerName localhost” (line number 95), and delete the # from the beginning of the line, and add 192.168.240.11. It should look like this:
Note:
[SOLVED] WEB375 LAB 5 CONFIGURE HTTP SERVER IN LINUX: Step 4: Start the Apache web server by typing:
#systemctl start httpd
Note: If you change your configuration file, the changes will take effect with the command:
#systemctl restart httpd
You can stop the service with this command:
#systemctl stop httpd
You can show the service status with this command:
#systemctl status httpd
Step 5: To check httpd status type:
#systemctl status httpd
An active httpd status looks like this:
Screenshot # 1
Clear the screen and type this command: systemctl status httpd. Capture the Skillsoft desktop and paste it into your Lab Report document.
Step 6: You are done with the setup.
If httpd fails starting, check for errors using command journalctl –xn, fix any typo in the /etc/httpd/conf/httpd.conf file, and restart the service with command #systemctl restart httpd until vsftpd starts successfully. Below is a sample of journalctl –xn command output without any error.
Step 7: To enable the vsftp server during boot, type the following command:
#systemctl enable httpd
[SOLVED] WEB375 LAB 5 CONFIGURE HTTP SERVER IN LINUX: TASK C –Validate and Test Web Server
Now we need to have two TigerVNC sessions, one logon on plabfed01 and the other on plabfed02
Note: Type 1 to logon as Student, and 2 to logon as root.
Arrange the VNC windows so we can switch back and forth easily by moving the cursor to the desired screen and right click. See below screenshot:
Note: Press the ESC key to bring back the active screen.
Step 1: We are using a text browser called links to display a web page. To install it on both systems, plabfed01and plabfed02, type the command:
#yum –y install links
Step 2: On the web server (plabfed01), create a simple web page and save it as index.html in your DocumentRoot directory:
Enter the following text:
Apache is cool!!!
This message is from your_name_here.
Your index.html file’s contents look like this:
Step 3: On the web client plabfed02, display the web page from the web server plabfed01 using the text browser links. Type the command as follows:
A sample text-based web page appears as follows:
Note: To open another terminal from links click on file then select “Open terminal”.
Screenshot # 2
Capture the Skillsoft desktop showing the content of the web page similar to the above screenshot, and paste it into your Lab Report document.
[SOLVED] WEB375 LAB 5 CONFIGURE HTTP SERVER IN LINUX: TASK D – Configure Virtual Hosting
In this part of the Lab, we will host two websites, www.papa.com and www.mama.com to the apache web server. Go to the plabfed01 server and login as root.
Step 1: For each website, create a DocumentRoot directory and an index page as seen below:
Use vi or nano to edit the index.html for papa.com and mama.com sites with the content below:
Screenshot # 3
Clear the screen and use cat to display the contents of the /var/www/virtual/www.mama.com/html/index.html file. Capture the Skillsoft desktop and paste it into your Lab Report document.
Step 2: Update the /etc/hosts file with the content below:
Step 3:
Use vi or nano to create the virtual configuration file /etc/httpd/conf.d/papamama.conf of apache server. The content looks like this:
Step 4: To check the syntax of the file, and before restarting the web server, type:
Step 5: To restart the HTTPD web server type:
[SOLVED] WEB375 LAB 5 CONFIGURE HTTP SERVER IN LINUX: TASK E –Test Virtual Hosting
Now we use Putty to logon plabfed01 as root to perform the testing.
Step 1: On the plabfed01 web server, display the www.papa.com web page using the text browser links. Type the command as follows:
A sample text-based web page appears as follows:
Note: To exit from Links, click on the top of the page and the Tool bar will appear. Click on File, then Exit.
Screenshot # 4
Capture the Skillsoft desktop showing the content of the papa.com web page similar to the above screenshot, and paste it into your Lab Report document.
Step 2: On the plabfed01 web server, display the www.mama.com web page using the text browser links. Type the command as follows:
A sample text-based web page appears as follows:
This concludes the Week 5 Lab.