Install firewall to the server
Introduction
A firewall helps protect your server from unauthorized access, malicious traffic, and network attacks. On Linux hosting servers, different firewall solutions are commonly used based on the control panel installed on the server.
For cPanel servers, ConfigServer Security & Firewall (CSF) is widely recommended. For Plesk servers, the APF firewall is commonly used.
Prerequisites
- Root or SSH access to the server
- Internet connectivity on the server
- wget and tar packages installed
Implementation
Install CSF Firewall on cPanel Server
From our experience, if you are using cPanel, it is recommended to use ConfigServer Security & Firewall (CSF).
Step 1
Download the CSF package from the ConfigServer website.
wget http://www.configserver.com/free/csf.tgz
Step 2
Extract the downloaded file.
tar -xzf csf.tgz
Step 3
Navigate to the CSF directory.
cd csf
Step 4
Install CSF using the following command.
sh install.sh
The CSF firewall is now installed successfully on your server.
Install APF Firewall on Plesk Server
For Plesk servers, the APF firewall is considered a suitable option.
Step 1
Download the APF firewall package from the RFX Networks website.
wget http://www.rfxnetworks.com/downloads/apf-current.tar.gz
Step 2
Extract the downloaded package.
tar -zxvf apf-current.tar.gz
Step 3
Navigate to the APF directory.
cd apf*
Step 4
Install APF firewall using the following command.
sh ./install.sh
The APF firewall has now been installed successfully on your Plesk server.
Conclusion
Installing a firewall such as ConfigServer Security & Firewall or APF helps improve server security by filtering unwanted traffic and protecting hosting services from unauthorized access.
