Hello everyone,
I’ve just deployed my first Droplet on DigitalOcean, and I want to ensure it’s secure by setting up a basic firewall. I’m a bit new to this, so I’m looking for advice on the easiest way to set up a firewall to allow only necessary traffic (like SSH and HTTP/HTTPS) while blocking everything else.
Should I use UFW, or is there a better approach? Also, are there any particular rules I should include to ensure that my Droplet is both functional and secure?
Thanks in advance for your help!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Heya,
I’ll be brief, whichever firewall you feel most comfortable with that should be what you choose in my opinion.
For me the easiest is UFW so I would recommend that.
Hey 👋,
Great question! Setting up a firewall is a key step in securing your Droplet, and I’m glad you’re on top of it!
Option 1: UFW (Uncomplicated Firewall)
UFW is a simple and easy-to-use firewall available on Ubuntu, and it’s perfect for most users. Here’s a basic guide to help you get started:
Option 2: DigitalOcean Cloud Firewalls
Alternatively, you can also manage firewall rules using DigitalOcean’s Cloud Firewalls. These are firewalls you can configure at the network level, and they apply automatically to all the Droplets you assign them to. One big plus is that they filter the network traffic before it ever reaches your server, unlike ufw where the firewall runs on the server itself.
Here’s a basic rundown:
Create a New Firewall – You can create and manage firewalls directly from the DigitalOcean Control Panel under the Networking tab.
Set Rules – You’ll be able to create rules for incoming and outgoing traffic. Similar to UFW, you can allow SSH (port 22), HTTP (port 80), and HTTPS (port 443).
Apply the Firewall to Your Droplet – Once you’ve created the firewall, apply it to your Droplet to enforce the rules.
More detailed information on setting up Cloud Firewalls can be found here:
Let me know how it goes!
- Bobby