Easiest Raspberry Pi Website





Introduction: Easiest Raspberry Pi Website

Vote for this if it is useful!

Free hosting can be a hassle with all of its limitations. Paid hosting is too expensive for your small projects. The Apache web framework is one of the easiest to setup on your Raspberry Pi. Let's get started.

Step 1: Materials

You'll need:

A Rasperry Pi (Any version)

An Ethernet Cable

An Internet Connection

A HDMI Cable or Composite Video Cable (Yellow)

A TV or Monitor that supports either HDMI or Composite Video (Yellow)

A Keyboard

A Micro USB Cable and USB Power Source

An SD Card (At least 4GB)

An Apple, Windows, or Linux Computer

Step 2: Installing Raspbian

First, you'll need Raspbian, a popular Debian-based operating system. It is pretty easy to install. Download it here through either a direct download or a torrent; Your choice.

Click for a Windows Installation Guide, Mac OS Installation Guide,or Linux Installation Guide.

Step 3: Setting Up Your Raspberry Pi

1) Slide your SD card into your Raspberry Pi

2) Plug your Pi into your router with the Ethernet cable

3) Plug your keyboard into a USB port on your Pi

4) Plug your Pi into a TV or monitor with either an HDMI cable or Composite Video Cable (Yellow)

5) Plug your Pi into a USB port near your router with the micro-USB cable

6) Your Pi will turn on. Wait for it to bring up the gray and blue installation menu

7) Follow the installation and hit Finish

8) By default, the username will be pi and the password will be raspberry, unless you changed it in the setup. If you ever need to go back to that setup, you can use the command sudo raspi-config.

9) Log in if you aren't already

If you want to go into desktop mode, type in startx . You won't want to have your Pi in desktop mode when you're not using the video output so as to conserve as much resources as possible. So when you are done configuring your Pi, restart it by unplugging and plugging it back in; Don't even log in, just plug it in. You'll still be able to load web pages if you aren't logged in.

Step 4: Remotely Accessing Your Pi

You probably don't want to go to your Raspberry Pi every time you enter commands. So you'll need to use PuTTY, an SSH command program. Download it here. Run it. Type in your Pi's hostname and click connect (make sure you are on the same network!). Now you can enter commands and you won't need your keyboard and video cables plugged into your Pi!

You can also port forward your Pi like you did earlier, but set the Start and End Ports to 22. Now you can access your Pi using PuTTY over the internet, or even FileZilla (although you will need to manage the access key).

Step 5: Installing Apache

Apache is an easy web framework that you can setup in minutes.

1) Type in the command sudo apt-get update . This will update Raspbian.

2) Once it is done updating, type sudo apt-get install apache2 -y . This will install apache.

Step 6: Installing PHP

You can install PHP by typing in the command sudo apt-get install php5 libapache2-mod-php5 -y . Now any PHP file you place in your website's folder will work.

Step 7: Your Website's Folder

In the folder /var/www/ on your Pi is a file called index.html. It is your default webpage. By typing in the command hostname -I you can find your Pi's hostname. Type that hostname into your web browser on a different computer that is connected to the same network and it will return index.html. You can remove index.html and put in any and all of your website's files into that folder.

Step 8: Portforwarding

In order for your website to be available on a WAN (Wide area network), you must port forward. This varies per router, so it may be a little different for you. First, you must find your Default Gateway; AKA: Your router's IP.

For Windows: Hold the WinKey+R and type in cmd. Hit enter and you have your command prompt. Type ipconfig and hit enter. Look for your Default Gateway. Mine is, but yours might be something like or
For Mac: On your mac bar, click the Apple button and then System Preferences. Select Network under Internet and Wireless. Select your connected network. Click the TCP/IP tab and your router's IP will be displayed below.

For Linux: Open terminal and type the following: route -n | grep 'UG[ \t]' | awk '{print $2}' (Or just copy/paste it). It will return ONLY your default gateway (Router IP address).

Go to your web browser and type in your Default Gateway that you just found. You may be asked to login. Portforward.com may help you find your default login/password, but it will most likely be admin/password, password/password, or admin/admin. It is admin/password for Xfinity routers.

Once you are logged in, you will need to find your portforwarding menu. It is under the Advanced menu for Xfinity routers.

Click "Add Service" if necessary. Name the new service. Enter your Pi's hostname. Set protocol to TCP/UDP. Make the Start Port and End Port set to 80 (for HTTP). Hit save and make sure it is enabled.

Your website is now accessible across the internet!

Step 9: Getting a Domain

A big part of a website is an easy-to-remember domain name. Sadly, common ones like .org, .net, and .com usually cost money. Although they are cheap, free is better. Domain names .tk, .ml, .ga, .cf, and .gq are free for one year thanks to http://www.dot.tk/. You can re-register those domains after the 1 year is up. Simply register a new domain and choose the 1 year free plan. Then click Manage Domain in your list of registered domains. Click URL Forwarding. Type in your IP address (You can find it here). Set Forward mode to cloaked so that your IP doesn't show up in your browser's URL bar. Hit Set URL. That's it! You can visit your website at any time over the internet by typing in your registered domain. Note that you may need to use a proxy to access your website using your new domain name. This is because you are on the same network as your Pi and you would be trying to access your own public IP address.

Once I figure out how to use nameservers instead of URL forwarding, I will update this, as nameservers are safer.



    • Science of Cooking

      Science of Cooking
    • Microcontroller Contest

      Microcontroller Contest
    • Spotless Contest

      Spotless Contest

    We have a be nice policy.
    Please be positive and constructive.




    Could I please use this idea for a contest?

    the projects are nice and useful, but this site has been totally taken over by adware. one ad to buzzile something send me a fake firefox patch virus !!

    Sorry but this site has gone way down hill !!!!!!!!!!!!!!

    That is probably adware on your computer, not the website itself.

    Thanks for the share man!

    I've been looking for a domain name company for some time now, to no avail.

    awesome! thanks for making an easy to follow simple tutorial.