Turning your Raspberry Pi into a personal web server

Picture of Turning your Raspberry Pi into a personal web server
LAMP is an acronym that stands for LinuxApacheMySQLPHP and are components required to run a Dynamic HTML webpage.

This instructable will demonstrate how you can turn your Raspberry Pi into a personal web server. The steps to install all of the components are relatively straight forward. After your personal web server is complete, you can use it to host a custom HTML or PHP resume, or a personal landing page which is what I chose to do. 
Remove these adsRemove these ads by Signing Up

Step 1: Materials

Picture of Materials
- Raspberry Pi

- SD memory card (4GB or larger)

- Power adapter compatible with the MicroB connector on the Raspberry pi

- Ethernet patch cable

- HDMI compatible monitor and HDMI cable

- USB Keyboard (no mouse is necessary, you can navigate the entire interface via keyboard. Arrow keys,  Enter, ESC, etc.)

Step 2: Preparation

Picture of Preparation
The Raspberry Pi always needs to boot off of an SD card loaded with an operating system (OS) disk image.

You may buy an SD card that has already been made bootable complete with the Raspberry Pi OS or you may buy a blank card and

There are many OS versions offered for the Raspberry Pi, however, in this example, I have chosen to use Raspbian “Wheezy”.

Download the OS disk image and write it to your memory card. To write the image I used Win32 Disk Imager. Once the image is written to the card, plug the card into the Raspberry Pi's SD card reader and power on the device. (Be sure you have all the proper I/O devices plugged in, i.e., keyboard, Ethernet cable,  HDMI monitor.)
1-40 of 41Next »
terryo12 days ago

I'm using this tutorial to set up a server for my senior design project. I got all of the apache installs done and functioning. I can pull up the ip on my computer which i am using to share my wifi connection with the pi. When I attempt to pull up the same page on my phone, it times out.

Is there something I am missing? Do i need to set a static ip?

both my phone and computer are logged into the same wifi network at school

beliveau11 days ago

To upload an html file, you will need to use an ftp client. I like to use the FileZilla client on my Windows machine. You will then be able to use your pi credentials (not root) to login by ftp. Note that when you connect by ftp you will land on your home directory (/home/pi). To get the files that you transferred via tp published to your web server, you need to ssh into your raspi and then move or copy them over to your webserver root which is /var/www

twright232 months ago

Hi I've completed all of the steps and everything has worked out perfectly. If there is any way I can get more information on how to upload a HTML document to the server that would be great!

kingafro0002 months ago

Nice! but its been one year since you made this but still no html.

agulesin2 months ago

Hi Mark,

I've had my Raspberry for a year or so but never got around to using it! Just trying your tutorial and run across a problem, I wonder if you (or anyone else!) can help!

I've downloaded the SD card image, it's "2014-12-24-wheezy-raspbian" and takes up 3.05Gb on my computer. But when I write it to the SD Card (with Disk Imager), it only takes up 55Mb of space - in fact the SD card's total size shows as 79Mb or something silly like that (it should be 4Gb).

Putting the SD into the Raspberry and booting gives a few lines of text which pass too quickly to read, then a four-colour screen pops up for a second or so. This repeats until I switch it off.

What have I done wrong? Any help greatly appreciated!

Abdullah Eyles,

Ankara, Turkey

agulesin agulesin2 months ago

OK - Found the answer, sharing for anyone interested:

"Under Windows, all you will be able to see is the /boot partition, which is in the MS-DOS VFAT format. Raspbian uses a different file system format for its system files."

agulesin agulesin2 months ago

Me again: I've discovered the REAL reason for repeated re-booting, the cable between my USB power supply and the Raspberry was too thin - I learned that from the Raspberry Troubleshooting forum.

In short, some micro-USB data cables use thin wires which aren't thick enough to transmit the power the Pi requires; it starts up then the voltage is not enough so it switches off and tries again, ad infinitum. Using a dedicated micro-USB power supply solved this (as most mobile phone chargers are these days).

So far I've got to the stage of installing SQL - thanks again Mark!

lee.sugden.92 months ago

Great tutorial! thank you

ratheeshbr5 months ago

I am a beginner on Raspberry Pi. When I tried to install apache2, its shown that, " Its the newest version. When I tried http://localhost/ on raspberry pi browser it works well. But I cannot connect to Rasppi from another PC using the IP address of the Raspbpi.

Can you please help? Is there anything error?

That's because http://localhost points to the. well local host. So it resolves to whatever machine its accessed on. You'll need to find out the IP of the RPi and put that into your browser, and that should get you one it (of course you need to first have the RPi connected to a network as well as the computer you'll access it from)

ofey ratheeshbr5 months ago

Can you SSH into your pi from another pc?

ofey5 months ago

This is great thanks. How can I now create a database and set up WordPress? Thanks, Shane

eltel5 months ago

Excellent tutorial, thank you.

For Future Reference. This code allows one to Chroot or "jail" a person to their home directory keeping them from browsing the whole system.
Create Group for sftp users:

sudo groupadd sftponly


Add the following to the end of the /etc/ssh/sshd_config file (sudo nano):

Subsystem sftp internal-sftp

# This section must be placed at the very end of sshd_config

Match Group sftponly

ChrootDirectory %h

ForceCommand internal-sftp

AllowTcpForwarding no


-------------Commands to create a new user-------------

----------------------(ex john.)-----------------------

---(replace 'john' with the user you want to create)---


sudo mkdir /home/john

sudo useradd -d /home/john -M -N -g users john

sudo passwd john

[enter password]

sudo chown root:root /home/john

cd /home/john

sudo mkdir files

sudo chown john:users /home/john/files

sudo usermod john -g sftponly

sudo usermod john -s /bin/false

sudo service ssh restart

BONUS: To mount a device such as a USB stick to your home directory,
sudo mount -t ext4 /dev/sda1 /home/john/files

This assumes you have an ext4 formatted USB drive.

You can do this by:
sudo mkfs.ext4 /dev/sda1

Assuming the USB drive you want to format is sda1
It will also erase all files off the device
Ext4 will allow you to chown the drive to your user instead of root

(this also is my workaround for the whole kitkat SDcard issue)

Dougless6 months ago

Really inspiring and interesting article! I used it for researching different possibilities before i made my own webserver using the Raspberry Pi, Model B.

Check out the site the Raspberry is hosting at the moment -

cnl221810 months ago

Thanks for the great tutorial! Got me setup quickly and correctly!

Drdray110 months ago

hi great tutorial! I am wondering how do you get to the part in step seven where you changes things from yes to no? I've already gotten to the black window with the options at the bottom

HI, thank you so much for this tutorial. Could you add the adding the html resume part soon. I am only 13 and just got the server working right and I have a html page i coded i want to put on there. (my eventual goal is to have my raspberry pi gpio's controlled online with a live video stream. i am good with the video stream but need to add the html.)

i just got it all figured out! i am going to use to get a subdomain for free because i have a dynamic ip and need a dns

GraziCNU (author)  derekiswise11 months ago

Glad to hear you figured out your own issue! Only 13? Good on you starting young! I wish I was that ambitious when I was that age haha.


Justinvent1 year ago
Awesome work! I'm going to build this in the coming weeks.
GraziCNU (author)  Justinvent1 year ago
Thanks man, keep me posted on what you choose to do with it!
Is it possible to use this sever with an address that does not show up as the sever's IP?
GraziCNU (author)  Justinvent1 year ago
If you know your pi's public IP address you can use an Internet domain registrar to forward and mask the IP with a personal domain name. GoDaddy is an obvious example, but I know there are others that are cheaper (I'll look into it and report back). Just a heads up as well, you also may run I to issues if your modem/router does not have a static IP. If it's dynamic, your public IP will change and you won't be forwarding your domain to the right address. I'm pretty sure if you call your ISP you can have them set your modem to a static IP.

Normally a static ip costs more. A possibility is it is a dns so you install the extra software and every time you ip changes it tells changes the ip in the registrar. Not only that but you get like 3 free sub domains when you sign up. Hope this helps

pidan1 year ago
Well done thanks
I wish to host multiple websites all with a different domain name but not the ip address (e.g
mechagen1 year ago
Is it possible to make a private steam game server out of this or would I need some more or different programs? By the way good work!
GraziCNU (author)  mechagen1 year ago
I have not personally attempted this, but in checking around, I have seen that this can be done. Thanks for the compliment too, by the way!
jblieden1 year ago
i have a question, when i see the black terminal page and it says rasberrypi on the top it looks like a windows 7 page. are you running the commands from another computer into the rasberrypi or the rasberrypi directly? This is for a school project so any help is appreciated.
GraziCNU (author)  jblieden1 year ago
I'm remotely running the commands from another computer by using SSH. Hop over to step #4, it explains a bit more about the process there. If you still have questions after skimming the instructions, just write back and I'd be more than happy to offer more assistance!
ibauters1 year ago
Sorry to bother you again so shortly, but I get a 403 for every file I upload (using FTP) to the raspberry pi, how can I fix the permissions so everything I upload is accessible from the web (octal 644)
GraziCNU (author)  ibauters1 year ago
(removed by author or community request)
I figured out how to fix it!
You need to adjust the 'umask' setting in vsftpd.conf
Works like a charm for me!
GraziCNU (author)  ibauters1 year ago
Glad to hear you figured it out! If you get a moment, feel free to post your adjustments here just in case someone else runs into the same issue :)
ibauters1 year ago
Can you explain how to install Node.js on a Pi with the server running like you explained here?
GraziCNU (author)  ibauters1 year ago
I've never installed it before, but I'd be more than happy to look into it for you. Give me about week and I'll create a full instructable for that :)
willb281 year ago
hay love the how to do you think you could make a how to on adding HTML :)
1-40 of 41Next »