This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

WAF vs Firewall: Manual Security vs Cloudways Malware Protection

Updated on March 20, 2026

9 Min Read
WAF vs Firewall

Key Takeaways

A network firewall blocks broad traffic based on IP and ports, while a Web Application Firewall (WAF) inspects HTTP traffic for application-layer attacks.

Setting up firewalls and malware scanners manually requires configuring UFW, ModSecurity, and ClamAV, which carries a high risk of server crashes and lockouts.

Cloudways automates application layer security with a one-click Malware Protection add-on that monitors, scans, and cleans your files and databases automatically.

Securing a server often starts and stops with a basic firewall. Once the ports are locked down and standard web traffic is allowed, it is easy to assume the hosted application is completely safe from outside threats.

That standard setup actually leaves a massive blind spot. Traditional filters only restrict server access based on IPs and ports. They never inspect the actual data passing through your open web connections.

If a hacker hides a malicious script inside regular HTTP traffic, standard defenses wave it right through. This blind spot drives the entire WAF vs firewall conversation.

In this guide, we will compare a web application firewall vs network firewall to explain how layered security actually works.

We will also cover their distinct differences, the headaches of manual configuration, and how to easily automate your entire defense strategy using Cloudways Malware Protection.

What Is a Web Application Firewall (WAF)?

A Web Application Firewall handles the traffic your network firewall ignores. It specifically monitors the HTTP and HTTPS requests interacting with your website.

Once a connection is established, the WAF reads the actual data payload. It does not care about IP routing. It checks what visitors are actually trying to do. Standard browser loading a page goes through fine. Automated script dumping SQL commands into a login form gets dropped instantly.

Here is what a WAF actively manages on your server:

  • Payload inspection: Checking the contents of incoming web requests for hidden code.
  • Exploit blocking: Catching Layer 7 attacks like Cross-Site Scripting before they execute.
  • Bot mitigation: Stopping malicious scrapers from interacting with your site elements.

The network firewall secures the infrastructure. The WAF secures the application logic.

Key Differences Between a WAF and a Network Firewall

That massive blind spot we talked about earlier becomes obvious when you put both tools side by side. A standard filter waves malicious HTTP traffic right through because it literally cannot see it.

These firewalls operate at completely different levels of your infrastructure. They look for entirely different threats. Here is a quick breakdown of how they compare.

Feature Network Firewall Web Application Firewall (WAF)
OSI Layer Layers 3 and 4 (Network/Transport) Layer 7 (Application)
Primary Target Server infrastructure Website and application code
Traffic Inspected IP addresses, ports, and protocols HTTP/HTTPS data payloads
What It Blocks Unauthorized IPs and closed port access SQL injections, XSS, and malicious bots
Placement Edge of the network perimeter Directly in front of the web application

This clear division of labor is why a basic port filter cannot stop a fake login attempt. It simply lacks the tools to read application data.

Why External Firewalls Are Not Enough

Network firewalls and external WAFs share a major limitation. They are strictly perimeter defenses. They sit at the edge of your server and filter incoming traffic.

That perimeter model completely fails when a threat bypasses the outer layer. A hacker might buy a stolen admin password for your website. They navigate to your login page and enter the correct credentials.

The network firewall just sees standard HTTPS traffic. The WAF sees a valid login request. Both systems approve the session and the attacker gets full access.

Once inside your dashboard, they can upload a compromised plugin or a malicious PHP script. Neither firewall will flag this activity. The user is fully authenticated and the malware is being uploaded through legitimate application features. Perimeter defenses simply cannot stop internal file modifications or actions taken by logged-in users.

The Problem with Manual WAF and Firewall Configuration

Managing a network firewall and a WAF on an unmanaged server is exhausting. Having total root control sounds great until you are forced to spend hours tweaking security rules just to keep your website online.

Setting up network defenses means writing complex routing commands. A single typo in your iptables configuration can instantly lock you out of your own server.

Configuring the WAF is usually worse. You install the software and suddenly legitimate buyers get blocked at checkout. You then have to constantly tune complicated regex rules to stop the firewall from flagging normal user behavior as an attack.

When malware inevitably slips past both of these perimeter defenses, the manual work multiplies. You are left reading through thousands of lines of raw server logs to hunt down compromised files. Building and maintaining this layered security yourself quickly turns into a full-time job.

The Automated Solution: Cloudways Malware Protection Add-on

Compared to the manual approach of writing complex routing rules and constantly tuning WAF configurations, securing a server with Cloudways is completely hands-off. The basic network firewall and WAF are already active by default.

To protect against internal threats that slip past the perimeter, you just enable the Malware Protection add-on.

This completely replaces the need for command line work. The system uses Runtime Application Self-Protection (RASP) to monitor your environment from the inside.

Instead of relying on static rules that you have to update, RASP evaluates PHP scripts in real time as they run. If a script tries to execute a malicious command, the system instantly blocks it.

It also takes over the actual cleanup process. You never have to dig through database tables or read raw server logs to find infected files.

The add-on features Deep Database Protection to uncover hidden threats and automatically removes the compromised code. You get a fully secured application without the configuration headaches.

Secure Your Server Without the Command Line

Skip the risky manual setup. Get a built-in WAF, proactive RASP defense, and automated malware cleanup in one click with Cloudways Malware Protection Add-on.

How to Configure Firewalls and Malware Scanners Manually

To understand exactly how much work the automated route saves, let us look at the manual alternative. For the sake of this tutorial, we will configure a network firewall, a WAF, and a malware scanner from scratch on a bare DigitalOcean droplet.

Step 1: Network Firewall Configuration

First, connect to your server via SSH. You need to use a tool like UFW to explicitly allow web traffic and block everything else.

Before you do anything, you must allow SSH connections. If you skip this, the firewall will permanently lock you out of your own server the second you turn it on.

Run this command and press Enter: sudo ufw allow ssh

Once it says “Rules updated”, run this command and press Enter: sudo ufw allow 80/tcp

Then, run this command and press Enter: sudo ufw allow 443/tcp

Now that your ports are open, turn the firewall on by running: sudo ufw enable (Hit ‘y‘ and Enter when it prompts you about disrupting connections)

To verify that your rules are actually active, run a status check: sudo ufw status

Checking UFW firewall status in terminal

Step 2: WAF Installation and Tuning

Now you need a Web Application Firewall to monitor the HTTP requests. We will install ModSecurity for Apache.

Run this command and press Enter to download the package: sudo apt-get install libapache2-mod-security2

Once the installation finishes, enable the module by running: sudo a2enmod security2

Then, restart your web server so the changes take effect: sudo systemctl restart apache2

Here is where the manual work gets tedious. That command only installs a blank engine running in a passive mode. You have to copy the default configuration file to make it active.

Run this command and press Enter: sudo cp /etc/modsecurity/modsecurity.conf-recommended /etc/modsecurity/modsecurity.conf

Now, open that file in a text editor by running: sudo nano /etc/modsecurity/modsecurity.conf

Inside that file, scroll down to find the line that says SecRuleEngine DetectionOnly. Change that exact text to SecRuleEngine On. Save the file by pressing Ctrl+O then Enter, and exit by pressing Ctrl+X.

Edit ModSecurity configuration to turn on SecRuleEngine

Confirming SecRuleEngine is On in ModSecurity

Even with the engine turned on, the WAF does not know what a hacker’s payload looks like. You have to manually download and extract the OWASP Core Rule Set.

Run this command and press Enter to download the files: wget https://github.com/coreruleset/coreruleset/archive/v3.3.2.tar.gz

Downloading OWASP Core Rule Set for WAF

Once the download finishes, extract the files by running: tar -xvf v3.3.2.tar.gz

Step 3: Manual Malware Scanning

Finally, you need a tool to scan your local files for anything that bypassed the first two layers.

Install the ClamAV engine by running this command: sudo apt-get install clamav

Once installed, update the virus signature database by running: sudo freshclam

Now, manually trigger a recursive scan on your public web directory. The -i flag ensures the terminal only outputs infected files. Run this command: clamscan -r -i /var/www/html

Running a manual ClamAV malware scan in terminal

Once the scan finishes, the terminal spits out a raw list of infected files. It does not clean them for you. You are left to open each flagged file, manually hunt down the malicious code block, and carefully delete it without accidentally breaking your website.

The real issue with this entire manual setup is the ongoing maintenance. If you install a complex WordPress plugin next week, your strict WAF rules might accidentally block your real customers from using it.

You then have to log back into the terminal, read through hundreds of lines of error logs to find out why they were blocked, and manually rewrite your configurations to fix the conflict.

How to Enable Cloudways Malware Protection

The manual method required configuring UFW ports, setting up ModSecurity rules, and downloading ClamAV signatures. This leaves a massive margin for error. A simple typo can lock you out of your server, WAF installations can cause port conflicts, and a malware scan can easily crash your system if it runs out of RAM.

Compared to that, Cloudways eliminates terminal commands, memory limits, and manual cleanup. The network firewall and WAF are active by default. To secure the application layer, you just enable the Malware Protection add-on.

Step 1: Navigate to Application Security

Log into your Cloudways Platform. Select your Server, choose your specific Application, and click on Application Security from the left management menu. Then, select Malware Protection.

Navigate to Application Security in Cloudways

Select Malware Protection in Cloudways Application Security

Step 2: Enable Protection and Auto-Scan

Click the Enable Protection button. This instantly activates real-time protection and automatically triggers your first comprehensive malware scan.

Click Enable Protection button in Cloudways

It sweeps your web files and, if you run WordPress, Magento, or Joomla, it performs a deep database scan. You do not even have to keep the platform open while it runs in the background.

Automated deep database and file scan running

Step 3: Monitor the Security Dashboard

Once active, the add-on replaces raw terminal logs with three straightforward tabs:

  • Malicious: This tab lists any active or quarantined threats. It shows the exact file path or database table where the malware was found and the automated action taken (Cleaned, Quarantined, or Removed). You can even view the injected code or restore files directly from this menu.
  • Scan History: This displays a complete log of all past scans, showing the total number of objects scanned and the results. You can also click “Start Scan” here to trigger an immediate on-demand check.
  • Proactive Defense: This is your runtime protection log. It details the proactive events where malicious PHP scripts were blocked before execution, showing the exact timestamp and script path.

Malicious tab showing quarantined threats in Malware Protection

Scan History tab tracking automated security scans

Proactive Defense tab logging blocked malicious scripts

Wrapping Up!

Securing a production application should not require you to constantly monitor terminal outputs or worry about crashing your own system with a basic malware scan. The manual approach using UFW, ModSecurity, and ClamAV is highly fragile.

One wrong keystroke can lock you out, and an oversized virus database can easily trigger an Out-Of-Memory error and take your server offline.

Cloudways completely eliminates this operational overhead. The network firewalls and web application firewalls are handled for you automatically.

By simply enabling the Malware Protection add-on for just $4 a month per application, your web files and databases are continuously monitored, scanned, and cleaned. It delivers complete website security without the constant risk of manual configuration errors taking your server offline.

Q. What’s the difference between WAF and firewall?

A. A traditional firewall monitors broad network traffic based on IP addresses and ports. A Web Application Firewall (WAF) specifically inspects HTTP traffic to block application attacks like SQL injection.

Q. Is WAF a layer 7 firewall?

A. Yes, a WAF operates at Layer 7, also known as the application layer of the OSI model. This allows it to analyze the actual content of web traffic to identify malicious payloads.

Q. What are the 4 types of firewalls?

A. The four main types are packet-filtering firewalls, stateful inspection firewalls, proxy firewalls, and next-generation firewalls (NGFW). Each offers different levels of traffic inspection and network protection.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Abdul Rehman

Abdul is a tech-savvy, coffee-fueled, and creatively driven marketer who loves keeping up with the latest software updates and tech gadgets. He's also a skilled technical writer who can explain complex concepts simply for a broad audience. Abdul enjoys sharing his knowledge of the Cloud industry through user manuals, documentation, and blog posts.

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour