UFW is used to manage firewalls on Linux servers.
Before enabling UFW, ensure SSH is allowed to avoid disconnecting the server.
sudo ufw allow ssh
sudo ufw enable
Opening Application Ports
If an application runs on a specific port, that port must also be opened.
Examples of commonly used ports:
sudo ufw allow 8000/tcp
Port 8000 is often used for backend/dev servers, but the correct port depends on which port your application is running on.
Another example:
sudo ufw allow 3000/tcp
sudo ufw allow 8080/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
Check Status
sudo ufw status
Recap
sudo ufw allow ssh && sudo ufw enable