Opening ports and firewall basics

Your VPS operating system may include a local firewall. Applications also need to listen on the correct ports.

Common ports

  • 22 — SSH
  • 80 — HTTP
  • 443 — HTTPS
  • 25, 465, 587 — email, where permitted

Ubuntu UFW example

sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable

Be careful when changing SSH firewall rules. Keep a console session available if possible.