That Raspberry Pi Server

Linux and Servers

Installing a Webserver

A step by step guide into install a web server

This Guide will show you how install Apache and PHP

You Will Need

  • SSH Software Like Putty

  • FTP Software Like Filezilla

  • A computer concreted to the same network as the PI

Getting Started

To make a web server you need apache2 and PHP.

Installing Apache

First you need to check to see if the repository is up to date. Type the following command

sudo apt-get update

Then Install apache 2

sudo apt-get install apache2

Now you you need to test to see if apache is running. To do this we need to find the IP address of the system. Type the following command.

If config

when you type this command in you should see the flowing thing

eth0     Link encap:Ethernet HWaddr b8:27:eb:af:a0:88
         inet addr:192.168.0.17 Bcast:192.168.0.255 Mask:255.255.255.0

Make note of the ip address (shown in bold)

Type in the IP address (shown in bold) into the web browser.

192.168.0.17

You should get the following result

Apache is now installed

Install PHP

To install PHP type the following command

sudo apt-get install php libapache2-mod-php php-mcrypt

when you have installed PHP you will need to reset apache2 with the following command

sudo service apache2 restart

To make sure that PHP has installed correctly type the following command to create a file

sudo nano /var/www/html/info.php

Type the following things to the new file

<?php
   phpinfo();
?>

When you have typed the text above save the file

Type in the IP address (highlighted in yellow into the web browser.

192.168.0.17/info.php

You should get the following result

When you have finished looking at the file type the following command. This will remove the file you just created

sudo rm /var/www/html/info.php