Version 2.7 is a legacy release, and these documents are no longer being maintained.

Firewall

It’s not in the scope of this document to cover a complex firewall configuration for your network. Instead, we are just going to show the easiest way to setup a basic firewall for your web server in order to accept HTTP traffic and to block any other incoming traffic.

Ubuntu provides a simple firewall configuration tool called ufw which we are going to use here. Let’s make sure that ufw is installed:

sudo apt-get install ufw

Accept connections to HTTP, HTTPS (SSL):

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

Allow access to your SSH server:

# From any IP
sudo ufw allow 22/tcp

# From a specific IP, e.g. 1.2.3.4
sudo ufw allow from 1.2.3.4 to any port 22 proto tcp

You are ready to go. Now we’ll activate the firewall:

sudo ufw enable

Any change will persist even if you restart the machine.

Version 2.7

Contents