05: Installing a Web Server
Learning Target
- Install the Nginx web server on the Raspberry Pi
- Verify that the server is accessible on the network
Resources
- 1️⃣ Control Computer (Windows PC)
- Runs Windows
- Used for:
- SSH connection
- Web browser testing
- This computer stays Windows the entire time
- 2️⃣ Raspberry Pi Console Computer (Sacrificial Machine)
- Provides:
- Keyboard
- Mouse
- Monitor
- Network cable
- This computer is not used as a Windows PC
- It exists only to support the Raspberry Pi
- Provides:
Instructions
In this lab, you will work in pairs to set up a real networked server using a Raspberry Pi running Ubuntu Linux. One computer will act as the server console (the Raspberry Pi with a keyboard, mouse, monitor, and network cable), and the other will remain a Windows client used to connect remotely.
First, you will power on the Raspberry Pi and find its IP address, which is how other computers locate it on the network. Using the Windows computer, you will then connect to the Raspberry Pi using SSH (Secure Shell), a tool professionals use to securely control servers without sitting in front of them.
Once connected, you will install Nginx, a widely used web server. Finally, you will verify that the server is working by opening a web browser on the Windows computer and loading a webpage directly from the Raspberry Pi using its IP address.
By completing this process, you will experience how servers are actually used in the real world: managed remotely, running Linux, and providing services to other computers over a network.
Part 1: Power On and Verify the Raspberry Pi
-
- Make sure the Raspberry Pi is connected to:
- Monitor
- Keyboard
- Mouse
- Network cable
- Power on the Raspberry Pi
- Wait until you see the Ubuntu desktop or login screen
- Make sure the Raspberry Pi is connected to:
Part 2: Find the Raspberry Pi's IP Address
Step 1: Open a terminal on the Raspberry Pi
On the Raspberry Pi console:
-
- Click Show Applications
- Open Terminal
Step 2: Find the IP address
Run:
ip a
Look for a line that looks like:
inet 192.168.x.x
Write this IP address down.
You will need it later.
Part 3: Connect to the Raspberry Pi from Windows (SSH)
Step 1: Open Windows Terminal
On the Windows PC:
-
- Click Start
- Type Windows Terminal
- Press Enter
Step 2: Connect using SSH
Type:
ssh username@IP_ADDRESS
Example:
ssh student@192.168.1.42
Press Enter.
Step 3: Confirm the connection
If asked:
Are you sure you want to continue connecting (yes/no)?
Type:
yes
Press Enter.
Step 4: Enter the password
-
- Type the password (nothing will appear)
- Press Enter
You should see something like this:
username@hostname:~$
Part 4: Update the System
Run:
sudo apt update
Enter the password if asked.
Wait for the command to finish.
Run:
sudo apt upgrade
Enter the password if asked.
Wait for the command to finish.
Part 5: Install Nginx
Run:
sudo apt install nginx -y
Wait until installation completes.
Nginx (Engine X) is a popular web server used on Linux. Another option is Apache. Adding -y to the command allows the installation to proceed without user intervention.
Part 6: Confirm Nginx Is Running
Step 1: Check for an active process
Run:
systemctl status nginx
Look for:
Active: active (running)
Press Q to exit. If this doesn't work try pressing CTRL+Z.
Step 2: Make Nginx autostart whenever the Raspberry Pi is turned on
Run:
sudo systemctl enable nginx
Part 7: Test the Web Server from Windows
Step 1: Open a browser
On the Windows PC, open one of these:
-
- Chrome
- Edge
- Firefox
Step 2: Visit the server
In the address bar, type:
http://IP_ADDRESS
Example:
http://w.x.y.z
Press Enter.
Step 3: Confirm success
You should see:
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working.
Troubleshooting
❌ SSH fails to connect
-
- Confirm the IP address is correct
- Confirm the Raspberry Pi is powered on
- Try reconnecting
❌ Nginx page does not load
-
- Check status:
systemctl status nginx - If needed, start it:
sudo systemctl start nginx - Reload the browser page
- Check status: