FreeBSD Tutorials

The purpose of these tutorials is to get to show you how to get FreeBSD to a minimum operational state to serve a web app. After being installed, software configuration on FreeBSD is (almost always) the same as on Linux, which opens up a lot of other online resources. One of the biggest differences (from the perspective of a user) between Linux and FreeBSD is where files are located, so I'll go through a minimal configuration of all the software I'm suggesting to help you get your bearings. Almost everyone will benefit from doing more configuration than I'm demonstrating.

Since I'm only covering the basics, these tutorials will omit configuration options wherever possible if they're not required (although additional configuration is suggested in some cases). If you're going to ask your users to submit personal information, you will need to do more securing of your server than I currently cover here.

I also don't really differentiate between working on a development environment and a production environment. It's a good idea to have separate dev and prod environments, though. I'll assume you know when you should be in each.

Topics Covered

Getting FreeBSD

Download links for images to install on a local machine, and VPS providers who have FreeBSD images available.

Initial Setup

How to get the software I like installed. If you have the same taste in software as me, you'll like it, too. I'm using Python 3, and since FreeBSD's packages are still on 2.7 by default, I'll show you how to use command line options to build the packages you'll need.

Configuring NGINX

Configure NGINX so that it can serve files from your choice of locations.

Configuring PostgreSQL

If you are a database hipster like me, you wouldn't dream of using MySQL since it's been taken over by Oracle. Keep up with the cool nerds and use Postgres!

Configuring uWSGI

If you want to use a Python application to access a database, you'll need a WSGI server. uWSGI is one of the most popular and most widely supported WSGI servers.

Secure Connections With PostgreSQL

SSL is one of the the easiest ways to encrypt connections to your database. Learn how to generate self-signed keys and set them up to ensure that no one is listening in on your traffic.

Hot Standby Replication With PostgreSQL

Accidents happen, so it's nice to have a backup database ready to go. Learn how to replicate your database with PostgreSQL 9 in this hot_standby tutorial.

Running Multiple PostgreSQL Instances

For those times when one server isn't enough, here's how you run a second server from FreeBSD's init.