Cloud firewall: Controlling server access cleanly

Titelbild: Cloud Firewall: Server-Zugriffe sauber regeln

Every unprotected WordPress server is scanned around the clock by automated bots—a cloud firewall blocks this unwanted traffic before it even consumes your server resources. Operating upstream in your host's network, it filters requests based on strict rules to improve both security and performance. This article explains how it works, which firewall rules you need for a WordPress server, and which configuration mistakes you should avoid.

As soon as a server goes online with a public IP address, automated botnets probe it for exposed services. A newly provisioned VPS often logs hundreds of login and scan attempts on SSH (port 22), databases, and admin interfaces within just a few minutes. The simplest and most effective countermeasure: only open the ports that are really needed. That is exactly what a firewall regulates.

With a Cloud firewall this filtering does not run on your server but in the provider's network, before the traffic reaches your server. In this article you learn how it works, how to configure it sensibly and how it interacts with other protective measures. You can find the basics of server setup in our articles Setting up a Linux server and Setting up an Ubuntu server.

What is a cloud firewall?

A firewall checks data packets against rules and lets them through or blocks them. There are two levels. The local firewall runs as software on the server, for example UFW or iptables. The Cloud firewall is provided by the hosting provider and sits in front of the server in the network. You manage it via the customer portal or an interface and assign it to one or more servers.

Advantages of the cloud firewall

  • Relief: Unwanted traffic does not even reach the server and uses no computing time.
  • Central management: One rule group can be applied to several servers.
  • Additional layer: If the local firewall fails due to a configuration error or system update, the cloud firewall reliably continues to protect your server.
  • Easy operation: Rules can be changed without SSH access, even if you have locked yourself out.
  • Often free: Many providers offer it at no extra cost.

Limits of the cloud firewall

A cloud firewall operates at the network and transport layers (Layers 3 and 4), filtering by IP address, port, and protocol. It does not detect attacks at the application layer (Layer 7), such as SQL injections or malicious code inside a WordPress request. For that, you additionally need a web application firewall (WAF) or dedicated security plugins. It also does not protect against weak passwords or outdated plugins. It is one building block, not all-round protection.

Cloud Firewall: Beitragsbild

The basic rule: block by default

The most important security principle is default deny (allowlisting or whitelisting): everything that is not explicitly permitted is automatically blocked. Many providers enforce exactly this behavior for incoming traffic (ingress) once a firewall is assigned. You then only define exceptions for services that are meant to be reachable. The opposite, allowing everything and blocking individual ports, is error-prone because you quickly forget something.

Massive steel gate, half open, with turquoise light behind it

Which rules does a WordPress server need?

For a typical WordPress web server, just four targeted rules for incoming traffic (ingress) are enough:

  • Port 80 (HTTP): Allowed from the entire internet so that visitors and certificate checks work. Redirect to HTTPS in the web server.
  • Port 443 (HTTPS): Allowed from the entire internet. This is the main access for your visitors.
  • Port 22 (SSH): Only from your IP address or a fixed range, not from the whole internet.
  • Ping (ICMP): Optionally allowed, for monitoring and troubleshooting.

You should not open the database port (3306), admin interfaces such as phpMyAdmin or panel ports, unless you restrict them to specific IP addresses. If you use Plesk, you should strictly restrict the HTTPS panel port 8443 to your IP and block the unencrypted port 8880 completely. You can learn more about the panel in the article Installing Plesk.

Outgoing traffic

By default, outgoing traffic (egress) is allowed so WordPress can download updates, connect to APIs, and send emails. If you want a stricter setup, you can also restrict outbound connections to essential destinations (such as DNS, NTP, package repositories, and WordPress.org). This requires more maintenance, but prevents a compromised server from exfiltrating data or joining a botnet. For most WordPress servers, however, the default setting is sufficient.

Step by step: setting up a cloud firewall

  1. Create the firewall: In the provider's customer portal, create a new firewall with a clear name, for example wordpress-web.
  2. Define incoming rules: HTTP and HTTPS from all sources, SSH only from your IP.
  3. Assign a server to the firewall: Only activate after testing the rules.
  4. Check access: Connect via SSH in a second window and open the site in the browser.
  5. Test from outside: Check with a port scan that only the desired ports are open.
  6. Document: Note down the rules and the reason so that you can trace them later.

Dynamic IP addresses

If your IP address changes, you quickly lock yourself out with an SSH restriction. Solutions: a VPN with a fixed IP, a small management server (bastion host) with a fixed address or a process that updates the rule automatically. If necessary, you can add your new IP address anytime in the provider's browser portal—this is where a cloud firewall delivers its biggest practical advantage.

Cloud firewall and local firewall together

The best solution is combining both layers (defense in depth). The cloud firewall stops unwanted traffic before it reaches the server, while the local firewall (such as UFW) provides additional control inside the system, for example for Docker containers or internal services. Make sure that the two rule sets do not contradict each other. If the site suddenly becomes unreachable, check both levels: a blocking rule can be on either one.

Complementary protective measures

  • Fail2ban: Blocks IP addresses after repeated failed attempts, for example on SSH or wp-login.php.
  • Web application firewall: Filters dangerous requests at the application level, for example SQL injection or cross-site scripting.
  • Rate limiting: Limits requests per IP to slow down brute force and bots.
  • Two-factor authentication: Protects WordPress accounts even if a password is stolen.
  • Regular updates: Close vulnerabilities that a firewall does not detect.

For WordPress-specific protection, take a look at our Security package.

Infographic: Setting up cloud firewall rules cleanly
Click to enlarge

Typical mistakes in firewall configuration

  • SSH open to everyone: Port 22 is the most common target of automated attacks.
  • Database reachable from outside: A classic mistake with serious consequences.
  • Locking yourself out: Rules activated without testing your own access.
  • Rules not documented: After months nobody knows why a port is open.
  • No review: Rules are set once and never looked at again.
  • Too many exceptions: Every exception weakens the concept. Less is more.
  • Firewall not assigned: The rules exist but are not assigned to any server.

Example configuration for a WordPress VPS

For orientation, a rule set as we use it for small to medium sites:

  • Incoming TCP 80 from anywhere: allowed
  • Incoming TCP 443 from anywhere: allowed
  • Incoming TCP 22 only from the office IP or VPN IP (e.g., 203.0.113.10/32): allowed
  • Incoming ICMP from anywhere: allowed, with limitation
  • Everything else incoming: blocked
  • Outgoing: allowed

This basic framework covers most cases. If you use Plesk, the panel port is added, but restricted to your IP. For mail servers, SFTP, or other services, the rule is: only open them if you truly need them, and restrict the source range as tightly as possible.

Monitoring and logs

A firewall is only useful if you can see what it does. Enable logs as far as your provider offers them, and occasionally check which accesses were blocked. Conspicuous patterns, for example many attempts on a certain port, show you where attackers are looking. Add monitoring that notifies you when the site is no longer reachable. A faulty rule often shows itself exactly this way. If an error occurs after changes, our article on the critical error also helps with narrowing it down.

Cloud firewall in practice: two short cases

Case 1: Brute force on SSH

A newly set up VPS shows hundreds of failed SSH logins per hour after two days. The operator restricts port 22 in the cloud firewall to their office IP, and the login attempts immediately disappear from the auth.log files. Fail2ban also stays active. The load drops, the log becomes clearer and the risk falls considerably.

Case 2: Open database port

A review shows that port 3306 is reachable from the internet because the database was bound to all interfaces. With a blocking rule in the cloud firewall and by binding the database service to localhost (127.0.0.1), the gap is closed on both layers. This shows the value of two levels: the firewall catches errors in the service configuration.

Cloud firewall checklist

  1. Default deny active for incoming traffic
  2. Only 80 and 443 open to the internet
  3. SSH restricted to a fixed IP
  4. Database and admin interfaces not public
  5. Firewall assigned to the right server
  6. Local firewall additionally active
  7. Fail2ban and WAF added
  8. Rules documented and checked regularly
  9. Access tested, emergency access clarified

When we take over the setup

If you have no time or desire for network rules, we set up the firewall as part of Set up server and VPS and document it. Ongoing care is part of our maintenance for $99 a month. In the free check we check whether your current setup has gaps.

Cloud firewalls at different providers: similarities and differences

Most large hosting and cloud providers offer their own firewalls. The names and interfaces differ, the basic principles are the same. There are usually rule groups that you assign to one or more servers. Each rule describes direction (incoming or outgoing), protocol (TCP, UDP, ICMP), port or port range and permitted source or destination addresses. Differences exist in the maximum number of rules per firewall, in extra features such as flow logs, server tags, and API automation, as well as in the default rules applied to newly created servers.

When switching to another provider, note that the default settings can differ. Some providers leave all ports open without an assigned firewall, others block incoming traffic by default. So check the actual state with a port scan from outside for every new server instead of relying on assumptions.

Do not forget IPv6

Many servers are also reachable via IPv6. If rules only apply to IPv4, the server may remain open via IPv6. Check whether your firewall covers IPv4 and IPv6, and define rules for both. This also applies to the local firewall, for example in UFW, where IPv6 has to be enabled. A common mistake is that with default deny active, no IPv6 rule exists for ports 80 and 443, locking out IPv6 visitors—or conversely, with permissive defaults, SSH access over IPv6 remains unintentionally reachable.

Management through automation

If you run several servers, it is worth managing firewall rules as Infrastructure as Code (IaC). Many providers offer dedicated APIs, CLI tools, or integrations for Terraform and Ansible. That way rules are versioned, reproducible and can be applied automatically to new servers. This prevents configuration drift in which one server is forgotten and stays open. Even without automation, the following applies: use descriptive names, use tags or groups for web servers, database servers and admin access, and document every exception.

Special scenarios

Database server separate from the web server

If database and web server run on different servers, you only allow the database port from the IP address of the web server, ideally via the provider's private network. The port stays blocked from the public internet. In addition, the database should be accessible only for the necessary user from this address.

Access via a VPN

For administrators with changing IP addresses, a VPN with a fixed exit address is a clean solution. You allow SSH and admin interfaces only from this address. This makes the services invisible to everyone else, and brute-force attempts run into nothing.

Load balancer and CDN

If a load balancer or a CDN sits in front of the server, you can restrict access to ports 80 and 443 to the addresses of these services. That prevents attackers from bypassing the protection and accessing the server IP directly. Note that the address ranges of the providers can change, so keep lists up to date.

Multiple environments: staging and production

Staging servers should not be reachable by everyone. Restrict them to your IP addresses or protect them with credentials and a firewall. Otherwise search engines and attackers can find test sites, which are often less well secured.

Emergency plan: when the firewall causes a disruption

  1. Check whether the rule was changed: Look at recent changes in the portal.
  2. Test from outside: With a port check, which ports are reachable.
  3. Access via the provider console: It works independently of SSH rules.
  4. Reset the rule or temporarily disable the firewall: Only briefly and in a controlled way, then immediately enable it again.
  5. Document the cause: So that the error does not happen again.

For website outages, narrowing down whether the cause lies with the server or with WordPress also helps. More on this in the article on the critical error. If you want to hand over the security, take a look at the Security package page.

Typical attacks that a firewall repels

  • Port scans: Automated search for open services. With default deny almost all ports stay invisible.
  • Brute force on SSH: Thousands of login attempts per day. Restriction to your IP makes them ineffective.
  • Attacks on databases: Open database ports are searched for specifically. Blocked ports prevent access.
  • Service exploits: Unpatched services with known vulnerabilities. Anyone who does not make them publicly reachable escapes many attacks.
  • Volumetric attacks (DDoS): Overload through huge amounts of data. A simple firewall helps to a limited extent, for this there are protection services from the providers.

Documenting and reviewing rules: a template

Keep a table with the columns rule, purpose, source, port, responsible person and date of the last review. Example: Rule "Allow HTTPS", Purpose "Public website access", Source "0.0.0.0/0 & ::/0", Port "TCP 443", Owner "Admin", Last reviewed "2026-10-01". Second rule: "Allow SSH", Purpose "Server administration", Source "Office IP (/32)", Port "TCP 22". Review this list at least quarterly, remove rules for decommissioned services, and audit every new exception. That way your rule set stays lean and traceable, and you quickly recognize when something unwanted is open.

Firewall rules for special cases with WordPress

Besides the standard rules there are situations that require separate approvals. For external payment providers like Stripe or PayPal that send webhooks to your WooCommerce store, access via port 443 must remain reliable. Since a network firewall does not filter by URL path, make sure—especially when using strict IP restrictions or an upstream WAF—that you do not accidentally block the payment providers' official IP ranges. If you use monitoring services, their addresses should not be blocked by accident, otherwise monitoring reports outages that are not real. For automated backups via SFTP to external storage (such as a Hetzner Storage Box), you need outbound connections on port 22 or the respective target port. After every new integration, check whether firewall rules need to be adjusted, and document it so that the list stays complete.

Interplay with WordPress security plugins

Security plugins in the backend complement the firewall at network level. They detect attacks at the application level, block suspicious login attempts, scan files for malicious code and report changes. But they do not replace a network firewall, because the attack only reaches WordPress once it has passed the network level. So rely on multiple layers: cloud firewall, local firewall, web server hardening, WordPress security plugin, and ongoing maintenance. Each layer catches the errors of the others. How we combine this for customers, see Security package.

Summary: your firewall concept in five sentences

Block everything by default. Open only 80 and 443 for everyone. Restrict SSH to your IP or a VPN. Additionally use a local firewall, Fail2ban and regular updates. Document and review the rules regularly, and test from outside that only the desired ports are open.

Conclusion

A cloud firewall is a cost-effective, high-impact first line of defense for any WordPress server: block incoming traffic by default (default deny), open only ports 80 and 443 publicly, lock down SSH via IP or VPN, and document every rule clearly. Combined with a local firewall, Fail2ban, a WAF, timely updates, and offsite backups, this creates a resilient security architecture. If you are unsure or do not want to set up server hardening yourself, we are happy to handle configuration, auditing, and ongoing maintenance for you.

Patch panel with many network cables and turquoise lights
Dramatic clouds with turquoise light over a dark horizon

Frequently asked questions about the cloud firewall

Do I need a cloud firewall if I use UFW?

Yes, combining both is best practice. The cloud firewall filters attacks at the network edge before they reach the server and saves resources, while UFW operates inside the OS and also secures internal services.

Is a cloud firewall free?

With many providers yes, with some for an extra charge. Check the terms of your provider.

Which ports do I have to open for WordPress?

For public access, only port 80 (HTTP) and port 443 (HTTPS) are required. You should restrict port 22 (SSH) and any hosting panel ports exclusively to your static IP address or VPN and block everything else.

Does a firewall protect against hacker attacks on WordPress?

Only partly. It blocks unwanted connections, but does not detect attacks via the website itself. For that, updates, strong passwords and a WAF are needed.

What is the difference between a firewall and a WAF?

A traditional cloud firewall operates at the network layer (Layer 3/4) and filters by IP address, port, and protocol. A Web Application Firewall (WAF) operates at the application layer (Layer 7) and inspects the actual content of HTTP requests for attacks like SQL injection or cross-site scripting.

What to do if I have locked myself out?

Change the rule in your provider's portal, or use the provider's console, which works independently of the SSH port.

How do I test whether my rules work?

Always test your server from an external network, for example using the command-line tool nmap (nmap -Pn your-server-ip) or an online port scanner. If the scan shows only your intended ports (such as 80 and 443) as open, your rules are working.

Can I block countries?

Some providers or WAFs offer geo-blocking. That can reduce attacks, but carries the risk of locking out real visitors.

Do I have to check the firewall regularly?

Yes, ideally quarterly (and at least twice a year) as well as after every major change to the server, so that no outdated rules or temporary test ports remain open.

Do you set up the firewall for me?

Yes, as part of the server setup or maintenance. Write to us via the Contact page.

Amine Boudounite

About the author

Amine Boudounite

Amin is the founder of Boudmedia and builds WordPress websites, online shops and business sites. In his guides he explains technology, loading speed and visibility so that you can apply them without any prior knowledge.

Contents
Help with your WordPress site?

We take a free look and tell you honestly what is needed and what it costs.

Share post

You might also be interested in

WordPress Backend Slow? How to Speed Up the Dashboard

Wenn das WordPress-Dashboard träge ist: Ursachen und Maßnahmen im Überblick.

Finding and Fixing a WordPress Plugin Conflict

So findest du den Plugin-Konflikt in WordPress und löst ihn ohne Datenverlust.

Google Shopping with WooCommerce: How to Make Your Feed Error-Free

Wie ein sauberer Produktfeed für Google Shopping aussieht und welche Fehler du in WooCommerce vermeiden kannst.

Problems with your WordPress site? We fix them at a fixed price.

  • Free check of your site
  • Honest assessment of what is needed
  • Fixed price before we start
  • Reply within 24 hours on business days
Scroll to Top