Configuring a Firewall on Your Linux Cloud Server
On this page
A firewall controls which network connections are allowed to reach your Cloud Server — an important first line of defense.
On Ubuntu or Debian (ufw)
Check the firewall's status
sudo ufw status
Allow a port
sudo ufw allow 80/tcp (replace 80 with the port you need, such as 443 for HTTPS or 22 for SSH)
Enable the firewall
sudo ufw enable — make sure you've allowed SSH (port 22) first, or you could lock yourself out.
On AlmaLinux, Rocky Linux or CentOS (firewalld)
Check the firewall's status
sudo firewall-cmd --state
Allow a service or port
sudo firewall-cmd --permanent --add-service=http, then reload with sudo firewall-cmd --reload
If you're ever unsure about a firewall change, contact our support team before applying it — an incorrect rule can block your own access to the server.
Did this answer your question?
Thanks, your feedback has been sent.