Wondering why by default, the UFW firewall is not active on Ubuntu. Or have you just install nginx and cant seem to make your firewall active? When you try to check its status, it will show that your firewall is inactive.
$ sudo ufw status Status: inactive
If you have disabled the firewall manually, it will show the same "status inactive" message.
Fix it in this simple step by the enable it command
sudo ufw enable
How to fix "UFW Status Inactive" in Ubuntu
You can fix this issue in three simple steps.
Step 1: Check the UFW Firewall status
First, you will have to check the status of the UFW firewall by using the following command:
sudo ufw status
Step 2: Enable UFW Firewall in Ubuntu
Once you find out that the firewall is not active, check if there are any rules added to it. This command will work even if the firewall is inactive.
sudo ufw status
Step 3: Recheck UFW Firewall status
To check the status, you will be using the same old command that I used at the beginning of this guide:
sudo ufw show added
Check the rules and ensure that if you enable the firewall, things will be okay for you. And then enable the firewall.
sudo ufw enable
More Commands on UFW...
Here's a quick summary of useful UFW commands.
Command | Description |
---|---|
ufw status | Check the status of the UFW firewall. |
ufw enable | Enable the UFW Firewall. |
ufw allow < rule > | Allow port/service through the UFW firewall. |
ufw deny < rule > | Drop the connection from a specific port/service on the UFW firewall. |
ufw status verbose | Get the detailed (verbose) status of the UFW firewall, which also includes logging levels. |
ufw status numbered | Shows UFW rules with numbers, which is helpful when you want to remove rules. |
ufw reject < rule > | Reject connection from specific port or service. |
ufw logging < logging_level > | Change the logging level of the UFW firewall. |
ufw delete <rule/number> | Delete the UFW firewall rule. |
ufw reload | Reload the UFW firewall. |
ufw disable | Disable the UFW firewall. |