DIY Web Server: Raspberry Pi + CloudFlare

by Andrew A. Schafer.

The Raspberry Pi was created with a simple mission in mind: change the way people interact with computers. This inexpensive, credit card-sized machine is encouraging people, especially kids, to start playing with computers, not on them.

When the first computers came out, basic programming skills were necessary. This was the age of the Amigas, BBC Micros, the Spectrum ZX, and Commodore 64s. The generation that grew up with these machines gained a fundamental understanding how how computers work.

Computers today are easy to use and require zero understanding of programming to operate. They’re also expensive, and wrapped in sleek cases. While aesthetically pleasing designs and user friendly interfaces make computers appealing and accessible to everyone, these advances create a barrier to understanding how computers work and what they are capable of doing. This isn’t necessarily a problem, but for those who really understand computers, it seems that our collective sense of the power of computing has been dulled.

Raspberry Pi marks the beginning of a conscious effort to return to computing fundamentals. Starting at about $25—case not included—it’s purposely designed to remove barriers to tinkering, reprograming, and, ultimately, to understanding how computers work. This return to fundamentals is rejuvenating the curiosity and creative spirit of computer hobbyists around the world.

The vibrant community of Raspberry Pi enthusiasts have found good use for an ARM processor, a GPU, a few ports, and an operating system (typically Linux-based) loaded onto an SD card. A quick Google search will return ideas for building your own Pi powered robots and helicopters, humidity and temperature sensors, voice activated coffee machines, and sophisticated home security systems—homemade cases encouraged.

Another slice of Pi?

Ok, maybe you don’t need a Lego wrapped, solar powered Raspberry Pi syncing your Christmas lights to techno music—most of us don’t. But there are a whole host of practical projects for Pi enthusiasts as well. One of our customers, Scott Schweitzer of Solarflare, turned his Pi into a web server.

It might seem crazy to host a website on an 8GB SD card since a small surge in traffic would knock the site offline. But with CloudFlare handing the load, speeding up the content, and keeping it secure, a Raspberry Pi is all Scott needed to host his sites. He started by testing one of his sites on his Pi-CloudFlare combo, and once he realized it worked, he called up his hosting provider to cancel his subscription. Now his Raspberry Pi sits in his closet using a trickle of energy, and CloudFlare provides the rest of the power.

Check out Scott’s project here.

Staying true to the Raspberry Pi mission, Scott provided resources for other members of the Pi community to use.

The Recipe:

Ingredients

  • 1 Raspberry Pi (the Model B + 512 MB is recommended)
  • 1 RJ45 Cat45 cable
  • 1 micro-USB power supply
  • 1 SD card

Directions:

  1. Follow these directions put together by ScottSchweitzer of Solarflare.

  2. Open port 80 on your home router and map it directly to your Raspberry Pi. Click here to learn more.

  3. Put CloudFlare in front of your Pi to protect it from vulnerabilities, and make your site fast and secure.

That's it!

This is the simple way of doing it, but Scott took a more roundabout path. He originally set up his Pi as a security penetration test tool using Raspberry Pwn Release 0.2 which is Debian 7 based. You can see that build here. Scott then later added Apache2, but since he didn’t need PHP or MySQL he left those off.

Note: If you prefer Nginx, see these instructions for installing it on your Pi.

By the way, if you like hacking on Nginx running on ARM CPU’s CloudFlare is hiring.

CloudFlare’s mission is to make the powerful tools used by internet giants accessible to everyone. Scott Schweitzer’s Raspberry Pi web server project is a perfect example.

Thanks for sharing your story Scott!

comments powered by Disqus