March 12, 2017

SSL for Raspberry Pi Nginx server with dynamic IP and Custom Domain

This posting is about how to host your own Raspberry Pi web server at home with dynamic IP with custom domain and SSL.

I tried many different methods and different ways to install certbot, but on RPi Raspbian Jessie Lite, this is the only way.

Goal

Host own web site(s) on Raspberry pi, with custom domain from home, and support SSL.

Environment

  • Raspberry pi + Raspbian Jessie Lite
  • Fast internet
  • Your ISP allows port 80 and 443
  • Own domain and you can edit DNS

Prep-work

  1. Set up Raspberry pi with static IP, and configure your router to port forward to your RPi web server, port 80 and 443(SSL) 
  2. Set up custom domain with dynamic IP.  Make sure you have correct settings in DNS set up.
  3. Set up Nginx on RPi

Set up SSL on RPi  

  • You have to do above prep-work before follow below steps.
  • It is assumed your web site's root doc directory is: /var/www/mysite/
  • It is assumed your custom domain is: www.mydomain.com
  • Nginx is up and running, and accessible by the custom domain.

STEPS:

March 11, 2017

Custom domain and dynamic IP

Goal

Make home Raspberry Pi server accessible from outside with custom domain.

Environment

  • Raspberry Pi with Raspbian Jessie Lite
  • High speed internet at home (e.g. Fios), dynamic IP
  • Appropriate ports are open: 80, 443, 23, etc.
  • Own domain and access to DNS setting


Steps

March 10, 2017

Raspberry Pi mount exFAT Flash Drive as storage

Goal

Mount USB flash drive to RPi.

I can use large SD card, but:
(1) I already have a small SD card I want to re-use, and want to separate OS and data.
(2) I want to back up/store from Windows for data files.
(3) large capacity flash drive is cheap.

Environment

  • Windows 10 64bit
  • RPi, Raspbian Jessie Lite

March 8, 2017

Post Raspberry Pi status on Twitter

Goal

Tweet RPi (and CHIP) status with temperature, external IP, etc.

Environment

  • Raspbian Jessie Lite
  • Python 2.7

Prepare Twitter Account

A Twitter account is needed to publish the status, and set it to private unless you want to make postings public.
  1. Register Twitter account
  2. Log on to Twitter with the account.
  3. Go to https://twitter.com/settings/account
  4. Change setting in Privacy and safety, Email notification, 
  5. Go to https://apps.twitter.com/
  6. Create New App and get following:
    • Consumer Key (API key)
    • Consumer Secret (API Secret)
    • Access Token
    • Access Token Secret
From your regular Twitter account, follow above account.

March 1, 2017

Setting up Raspberry Pi, wifi, static IP


Goal

Set up headless RPi, Wifi with static IP.

Environment

  • Windows 10 64bit
  • Raspberry Pi 1A, 1B, 3B, Zero
  • External monitor, powered USB hub, wifi dongle, keyboard/mouse.
  • RPi OS; Raspibian Jessie Lite 

Although I will be using RPi headless, the easiest way to set up is hook up external monitor, powered USB hub, connect keyboard mouse + wifi module.  I tried different headless set up, but they all were too inconvenient, especially with RPi models with only one USB port.


Install/Setup Raspberry Pi on SD

  1. Raspberry Pi OS download: https://www.raspberrypi.org/downloads/
  2. I got the easy one, Raspbian Jessie Lite, https://www.raspberrypi.org/downloads/raspbian/
  3. Use Win32 Disk Image to write the OS onto SD card https://sourceforge.net/projects/win32diskimager/ 

Setting up RPi