Implement server-side firewalls to control inbound/outbound traffic.
- Update packages:
apt update - Install UFW:
apt install ufw - Allow essential ports:
ufw allow OpenSSHandufw allow 80,443/tcp - Set default policies:
ufw default deny incomingandufw default allow outgoing - Enable:
ufw enable - Verify:
ufw status verbose
For CentOS: Use firewalld instead: firewall-cmd --permanent --add-service=http and firewall-cmd --reload.