Don’t eat this Raspberry Pi!

How I use a Raspberry Pi to host a website.

Advertisements

Ok, ok, stupid title.  I thought I’d write about my website which is hosted from a cupboard at home.

That’s right the Aperture Films Website is hosted from my home by a Raspberry Pi that is in a cupboard, and surprisingly it has held up quite well.  I’m a technical sort of person, I work in electronics, I have played with electronics since primary school.  It was about 12 months ago,  my internet speed was upgraded and I now get around 50 Mbps upload speeds and about 220 – 250 Mbps download.  I figured this was fast enough to handle a low traffic volume website such as mine.

I didn’t wan the extra power bill of running a full PC at home 24 hours a day, so I thought I’d give it a go with a Raspberry Pi that I had laying around.  A raspberry pi is a credit card sized computer that can run a Linux operating system.  I was already running the website on an unmanaged VPS, so I was quite comfortable with setting up web server software and all that goes with it.

So for those that won’t the tech details here it goes:

  • TP-Link WR-1043nd router running open WRT custom firmware.
    • Running my own dynamic DNS script which updates my DNS A record when my dyanmic ip address changes.
      • DNS Zone file hosting is with Cloudfare, they have an API to change things in the zone file.
    • Open WRT is running Lighttpd web server just for a virtual hosting proxy to pass traffic to the appropriate other servers within my LAN.   This way I could have multiple things running on port 80
    • Any HTTP port 80 requests for aperturefilms.com.au get redirected to https on port 443.
      • The main website uses SSL which operated on port 443, the router is just port forwarding 443 straight to the raspberry pi as I don’t use anything else that requires port 443.
  • Raspberry PI 3 Model B (originally had it running on a first generation Model B+)
    • OS is Raspbian
    • Running lighttpd for hosting the main website and also MySQL for the online ordering database.
  • Cloudfare CDN.
    • To give more reliability and stability to the website, and also redundancy if the power goes out or the pi crashes, or my internet falls over etc…
  • Our website is full SSL
    • Cloudfare offers SSL connection from Cloudfare to Client for all the sites using them, but it doesn’t mean it is SSL from Server to Cloudfare.  Be assured that our site uses SSL for the connection between Cloudfare and the Raspberry PI.

So far it has worked quite well.  Online ordering is fairly new to our website and I was slightly concerned how that would go, but after having a school use the online ordering option, and all the extra traffic and database requests because of the online ordering, the Raspberry Pi hasn’t missed a beat.

So for anyone that’s wondering if they can host a website from home with a raspberry pi, well yes you can.  If it is anything but a low volume website I would recommend going for something a bit higher end such as a VPS or managed hosting plan.

Lastly, I don’t take the payments with my Raspberry pi, there is no way I want to have the responsibility and security concerns of taking credit card numbers on my own server,  I hand clients over to PayPal for taking payments.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s