Apache2 Webserver on a Raspberry Pi




100 Points
Learning Objectives

These instructions will show you how to run Apache2 website software on a Raspberry Pi.

More information on Apache is available online.
Being able to use this software will greatly simplify working with the Raspberry Pi to learn how websites work.

After completing this assignment you will be able to:

  1. Run Apache2 on a Raspberry Pi
  2. Find and edit a website file served by Apache2
  3. View your (or other's) website on your Raspberry Pi and laptop

Assignment Overview
This assignment reviews basic computer concepts that you will need in this course and throughout your career.

You are expected to have a working knowledge of SBC hardware and software.
If you do not understand how to use an item, perform a Google Search, refer to the WSU Technology Knowledge Base,  ask a teaching assistant, or ask the instructor.


Exercise 1-Running Apache2

ref: PiMyLifeUp Article

  1. These steps are performed on the Raspberry Pi.
  2. Check to ensure the Raspberry Pi software is up to date.
    Open a Terminal window and enter the following commands:
    sudo apt update
    sudo apt upgrade
  3. In the Terminal window enter the following command to install the Apache2 webserver:
  4. Open a browser and ensure the Apache2 webserver is running by browsing to both these urls:
    127.0.0.1
    current IP address can be found by entering hostname -I into a Terminal window
  5. If the Apache2 webserver is not running, in a Terminal window enter the following command:
    /etc/init.d/apache2 restart
    To stop the Apache2 webserver, in a Terminal window enter the following command:
    /etc/init.d/apache2 stop
  6. After Apache2 begins, the following webpage will load, which you must read.

    webserverApache Webserver

  7. If the webpage does not appear, troubleshoot and resolve any issues.

Exercise 2-Examine Apache2
  1. These steps are performed on your Raspberry Pi.
  2. The materials on the 'Apache2 Debian Default Page' describe details of the webserver installation.
    Note that the local website root folder is at /var/www/html/
  3. Create a new 'home page' for your website by using VNC Viewer to transfer the file 'homepage.html' from this IOT02 assignment folder to the desktop /home/pi/Desktop/
  4. In the terminal window do the following to modify the homepage.html file:
    cd Desktop then press Enter
    sudo nano homepage.htmlthen press Enter, and you are in superuser(su) edit mode
  5. Press the space key, then the backspace key, and 'Modified' will appear in the top right corner.

    edit homepage fileModify homepage.html

  6. Press the 'Ctrl+X' keys, then press 'y' and then press 'Enter'
    In the 'File Name to Write' row, enter
    /var/www/html/homepage.html
    and then press enter.
    When asked to save file under a different name, press 'y'

    save homepage fileSave homepage to Website Root Folder


Exercise 3-ScreenShot

Use your laptop to view your modified webpage on the Raspberry Pi running the Apache2 webserver.

  1. Find the IP address of your Raspberry Pi by opening VNC server in the upper right corner.
  2. Type this Raspberry Pi IP address into the address bar of your laptop browser.
  3. Your modified home page will appear, similar to below:
    new home pageNew Home Page
  4. On the Raspberry Pi, open a text editor and enter the following information:
    Your Name
    Your Class
    Todays Date
    IOT01
  5. Take a screenshot with Apache2 running and displaying 'homepage.html' along with your personal information in the text editor.
  6. On your laptop save the screenshot as "IOT02" in your ' ' folder.

ScreenShot IOT02


Upload Screenshot

Submit to the appropriate D2L Assignment folder a screenshot that documents your work.


(50) 1. Upload your screenshot to the 'IOT02' D2L Assignment Folder.


Exercise 4-Reflections

Based on your experience in this exercise and what you just learned, develop a brief statement about the value of Apache2 as a web server software platform for organizations.
Think about what type of problems these devices could solve, and would it be cost-effective?
Consider businesses that deploy IoT 'solutions', on the order of thousands or millions of devices-how can Apache2 equipped Raspberry Pis support or automate these efforts?
One example is the need to monitor and display sensor or actuator information from IoT devices-are they online? are they working? are they reporting problems?
References:
Apache2: Apache
PiMyLifeUp Apache2 Article

(20) 2. Reflections-value


(20) 3. Reflections-content
Research the internet to determine what type of data (text, numbers, audio, video...) can be displayed in a webserver.
List a use that you find particularly interesting.

Submit Assignment

When all tasks are completed press the Submit button.


(10) 4. Assignment submission



Congratulations! You have successfully used Apache2, a web server, on a Raspberry Pi single board computer.


-- WHEN DONE --
SHUTDOWN THE RASPBERRY PI
TURN OFF THE POWER