Implement server-side firewalls to control inbound/outbound traffic.

  1. Update packages: apt update
  2. Install UFW: apt install ufw
  3. Allow essential ports: ufw allow OpenSSH and ufw allow 80,443/tcp
  4. Set default policies: ufw default deny incoming and ufw default allow outgoing
  5. Enable: ufw enable
  6. Verify: ufw status verbose

For CentOS: Use firewalld instead: firewall-cmd --permanent --add-service=http and firewall-cmd --reload.

Was this guide helpful?

Thanks for your feedback!