This article describes how to configure your Uncomplicated Firewall (
ufw) software firewall to allow web traffic on port 80 (HTTP) and port 443 (HTTPS).
ufw is the default software firewall for Debian®-based distributions.
You need to have the following prerequisites:
Basic understanding of Secure Shell (SSH)
Sudo or administrative access to your server
A cloud server with Debian or Ubuntu® running
These steps are only for non-RackConnected Cloud servers. If you are using RackConnect, you can make similar changes on your dedicated firewall.
Log in to your server by using SSH and then complete the steps in the following sections for your preferred setup method.
ufwis the default software firewall solution for most Debian-based distributions, you should note that
ufwacts as a wrapper for
iptablesand you can disable the firewall. Before proceeding with the following steps, ensure that
ufwis running on your server by running
systemctl status ufw.
Use the following one-line command to open the open the firewall ports:
sudo sh -c "ufw allow http && ufw allow https"
If you prefer to configure the software firewall by using discrete steps instead of by using the one-line command, perform the following steps:
Run the following command to allow traffic on port 80:
sudo ufw allow http
Run the following command to allow traffic on port 443:
sudo ufw allow https
After you complete the preceding steps, you have configured your server to allow HTTP and HTTPS web traffic through your
ufw software firewall. If you've configured your website to accept traffic on ports 80 and 443, you should be able to visit both the HTTP and HTTPS versions of your website.
Updated 26 days ago