Securing Your VPS with UFW Firewall
UFW (Uncomplicated Firewall) helps you manage firewall rules on your VPS and block unauthorized access.
Step 1: Install UFW
sudo apt update && sudo apt install ufw -y
Step 2: Allow SSH
If your SSH is running on port 2222:
sudo ufw allow 2222/tcp
Step 3: Allow Other Services
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
Step 4: Enable UFW
sudo ufw enable
Step 5: Check Status
sudo ufw status verbose
✅ Now your VPS only allows trusted connections and is protected from unwanted traffic.