Skip to content

Customize a server's firewall

If you need your server’s firewall rules to be different from the firewall rules configured by ServerPilot, you can customize your server’s firewall.

Before customizing a server’s firewall

Before customizing your server’s firewall, first disable ServerPilot’s management of your server’s firewall. If you don’t disable ServerPilot’s management of your firewall, your customizations may be lost or may conflict with ServerPilot’s firewall rules.

To disable ServerPilot’s management of a server’s firewall, log in to ServerPilot, go to the server’s Settings, and disable the firewall option.

Reset the server’s firewall

To reset a server’s firewall to the original firewall rules configured by ServerPilot, disable and then re-enable the server’s firewall from server’s Settings page in the dashboard.

Customize a server’s firewall

Using your server provider’s firewall

The safest way to define your own firewall rules is to use the firewall features from your server provider.

Using the firewall features from your server provider ensures you cannot lock yourself out of your server due to an incorrect firewall rule. If you make a mistake, you can remove the custom firewall rules at your server provider.

Using the ufw command

If you are unable to customize the firewall at your server provider, then the easiest tool for customizing the firewall within your server is the ufw command.

If you make a mistake when customizing your server’s firewall with ufw, you may lock yourself out of your server. If you are locked out of your server due to an incorrect firewall configuration, you may need to restore your server from a snapshot at your server provider.