Blog
Setting up a Raspberry Pi Web Server

When people first see the specs on a
The
I think you might also be surprised just how much traffic a
Parts List for this Project:
If you want a quick parts list to build your
- Raspberry Pi Model B+*
- Micro-SD Card
- USB Thumb Drive
- Raspberry Pi Power Supply
- Raspberry Pi Case
- USB Card Reader
Setting up a Raspberry Pi Web Server
Let’s move along on our adventure! First thing you need to do is install the Raspbian operating system on your
Step 1: Boot your
[code language=”bash”]
sudo apt-get update
sudo apt-get upgrade
[/code]
Step 2: It’s now time to install the Apache web server software.
[code language=”bash”]
sudo apt-get install apache2 -y
[/code]
Step 3: Although this step is optional we highly recommend you reboot your
[code language=”bash”]
sudo reboot
[/code]
Step 4: Once you Pi has booted back up, on another device or PC browse to the IP address of your
Hint: if you don’t know your
Modifying the Raspberry Pi Web Server Default Page
If you’d to have a little fun and edit the contents of the
[code language=”bash”]sudo nano /var/www/html/index.html[/code]
You can also copy this page to another file as follows to create an additional page:
[code language=”bash”]sudo cp /var/www/html/index.html /var/www/html/mypage.html[/code]
Installing and using PHP on the Raspberry Pi Web Server
If you want to do anything beyond basic web pages you’ll want install PHP on your
Step 1: Open a terminal window and type the following command to install PHP.
[code language=”bash”]sudo apt-get install php7.0 libapache2-mod-php7.0 -y[/code]
Step 2: Create a PHP page in the html directory in Nano.
[code language=”bash”]sudo nano /var/www/html/myphppage.php[/code]
Step 3: Enter the following code and then save the php file.
[code language=”bash”]
<?php phpinfo(); ?>
[/code]
Step 4: In a browser on another computer, browse to the IP address of your
You will be presented with a webpage showing some basic stats and information on your server. The PHP info page.
That’s the basics of installing your