How to setup a UFW firewall on Ubuntu 16.04 LTS server

Originally published at:

How do I setup a firewall with UFW (uncomplicated firewall) on an Ubuntu Linux 16.04 LTS server to restrict traffic on my personal web-server that hosts my pictures and blogs for my family members?

First you must understand how UFW works, and avoid problems.

Check this: