Project by

With immense variety of web servers in the market, choosing the right one for the right reason is very difficult. In that case comparison between various servers will result to an utter confusion. The reason behind this confusion is, whenever you search for the server with greater performance, immediately your cost of installation increases. And to decrease the installation cost you have to choose a server which is less efficient. So, it is completely your decision to choose the right one. First of all you must know your requirements. For the purpose of testing environment or to simply store files, a cheaper web server is enough for the system. And for higher efficiency and greater work pressure your system would require a costlier web server which delivers immense performance.

In case of Raspberry Pi, it will serve your purpose as a cheap server. We know that a Raspberry platform delivers moderate work efficiency but maintains high cost efficiency. Similarly, if Raspberry Pi platform is converted to a Web Server, it will deliver the basic functions with low installation cost. So refer the article to make a low cost Raspberry Pi web server. 

Raspberry Pi web server

Raspberry Pi web server

This is simply a manual to the processes involved in converting a Raspberry Pi into a web server.

How to make a Raspberry Pi Web Server

Components required:

  • Raspberry Pi (Latest model)
  • Raspbian running SD card
  • MicroUSB power cable
  • USB WiFi Adapter
  • USB keyboard and mouse

Let us get into the steps involved for conversion:

To start the Raspberry Pi Operating System

In order to set up the Pi Operating system you need to follow the below steps:

Step1: Download Pi operating system preferably the Raspbian, which you can get from any source via internet.

Step2: Obtain a tool called Win32 Disc imager from any available link. This tool will help extract the image to the Raspbian running SD card. This is done through some simple steps.

  • Inform the drive letter about the inserted SD card.
  • Choose the location of the Raspberry Pi icon
  • After choosing, select burn.

Step3: After burning the SD card, place it inside the Pi at its appropriate position. Along with the SD card start plugging the other cables. But one should remember that mini USB must be plugged last.

Step4: By now the Raspbian operating system gets loaded in the system. Immediately after completion of loading procedure you need to log in by using the default username “pi” and default password “raspberry”.

Step5: Change the default password. Enter the new password again and confirm it. While typing the new password the cursor on the screen will not move.

Optimization of the softwares

Step1: As you are using the fresh version of Raspbian OS, so some amount of optimization of the software has to be done. In this step you need to update the sources, the clock and also upgrade any pre-installed software packages. For this, type the required update on the command line and press enter after every line.

Step2: Set the date and time in a similar way by just typing the required data on the command line and then press enter.

Update your system

Step1: In order to update your Pi, you need to install the Hexxeh’s RPI update tool. Installation of this tool is carried out in the following commanding process:

"sudo apt-get install ca-certificates
sudo apt-get install git-core
sudo wget  -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update
sudo rpi-update
sudo shutdown -r now"

Installation of SSH

Step1: This step involves noting the I.P. address of the Pi. Here you have to be connected to internet. You will be able to see the following commands on the screen of your computer.

"eth0      Link encap:Ethernet  HWaddr fe:fd:45:xx:xx:xx
          inet6 addr: fe80::fcfd:xxx:xxx:xxx/64 Scope:Link
          RX packets:35463998 errors:0 dropped:0 overruns:0 
          TX packets:30563995 errors:0 dropped:0 overruns:0 
          collisions:0 txqueuelen:1000
          RX bytes:11300336376 (11.3 GB)  TX 
bytes:33179556297 (33.1 GB)

If you are connected to Ethernet then eth0 will be shown on the screen. For other connections the icon will be different. The second line of the above command gives you the I.P. address of your Raspberry pi.

 Step2: This step is to enable SSH and restart it after receiving the I.P. address of the system.

"sudo /etc/init.d/ssh start
sudo apt-get install ssh"

Then, reboot your pi:

"sudo shutdown -r now"

 Step3: Now you can release the keyboard and the monitor from the system as rest of the task will be taken over by SSH.

Step4: Obtain an SSH client, preferably PuTTy from Google and connect it to the I.P. address of the Pi.

Installation of the Raspberry Pi Web Server

Though the previous steps were important for the entire process, yet this step is considered as the pillar of creating the Raspberry Pi web server.

Step1: In this step you have to install Apache and PHP in order to set up the server. For this purpose you must follow the below command

"sudo apt-get install apache2 php5 libapache2-mod-php5"

Step2: Now reboot the entire program using either of the following commands.

"sudo service apache2 restart"


"sudo /etc/init.d/apache2 restart"

Step3: Finally enter the I.P. address and the screen will show “It Works”.

Installation of MySQL

Installation of MySQL is simply initiated by installing few packages which requires following the given command.

"sudo apt-get install mysql-server mysql-client php5-mysql"

 Installation of FTP

Till now all the processes performed were to install software which is used to check the environment. For transferring data from Raspberry Pi and vice versa, installation of FTP is required.

Step1: This step involves capturing the web-root by following the given command.

"sudo chown -R pi /var/www"

Step2: Now start the installation of vsftpd by simply using the command

"sudo apt-get install vsftpd"

Step3: In this step edit the vsftpd configuration file in the below manner.

"sudo nano /etc/vsftpd.conf"

Step4: Incorporate the following changes:

-anonymous_enable= NO, which was previously YES

-uncomment local_enable=YES, by removing the # symbol which was present previously.

-uncomment write_enable=YES, by removing the # symbol which was present previously.

-force_dot_files= YES, you will get this at the bottom of the file.

Step5: Firstly save the file and then exit it by simply pressing the buttons CTRL-O and CTRL-X respectively.

Step6: Now reboot the vsftpd using the following service

"sudo service vsftpd restart"

Step7: Create a shortcut from the Raspberry Pi homepage to /var/www. This done in the given way

"ln -s /var/www/ ~/www"

Step8: You are now able to use FTP through a Pi and have access on /var/www folder through the shortcut which will appear after login as “Raspberry Pi Web Server”.

Cluster of Raspberry Pi web server

Cluster of Raspberry Pi web server

Hence Pi has been converted into a Web Server which has a low energy consumption of around 5w. Being a Web server, it is now installed with SSH, PHP5, MySQL server, vsftpd server and phpMyAdmin. So try to make this simple Raspberry Pi web Server. 

User Review (0)
Related Items