Since 2016 · 50,000+ customers · ★ 5.0 on Google Live chatWhatsAppTelegramOpen a ticket
Get started
VPS and Hosting

Best Antivirus and Malware Protection for Web Servers

Best antivirus and malware protection for web servers by 99RDP

A hacked web server can serve malware to visitors, send spam, mine cryptocurrency or get your IP address blacklisted, and you may not notice for weeks. Antivirus for servers works differently from antivirus on a laptop: the threats are mostly web shells, injected PHP code, backdoors, rootkits and compromised CMS plugins rather than classic viruses. This guide covers the best free and commercial malware protection tools for Linux and Windows servers, what each one is good at, and how to combine them with the hardening steps that prevent infections in the first place.

Quick answerOn a Linux web server, use ClamAV with Linux Malware Detect (maldet) for scheduled malware scans, rkhunter or chkrootkit for rootkit checks, and Lynis for a security audit. On servers running cPanel, Plesk or DirectAdmin, Imunify360 (or the free ImunifyAV) adds real-time scanning and a web application firewall. On Windows Server, keep Microsoft Defender Antivirus enabled. For WordPress, add a security plugin such as Wordfence.

What server malware looks like

  • Web shells: small PHP or ASPX files that give an attacker a control panel on your server.
  • Injected code: obfuscated JavaScript or PHP added to themes, plugins or index.php, often redirecting visitors to scam pages.
  • Spam mailers that use your server to send phishing email.
  • Cryptominers that max out the CPU.
  • Rootkits and backdoors that hide processes and keep the attacker in after you change passwords.
Layers of server protection: updates, firewall, malware scanners, integrity checks and backups
Layers of protection

1. ClamAV

ClamAV is the standard open-source antivirus engine for Linux, maintained by Cisco Talos. It scans files, archives and email attachments against a frequently updated signature database.

sudo apt install clamav clamav-daemon
sudo systemctl enable --now clamav-freshclam
clamscan -r -i /var/www

Best for: scheduled scans of web roots, uploads and mail. It detects known malware well but misses many custom PHP backdoors on its own, which is why it is often paired with maldet. The daemon needs 1 GB or more of RAM to load its signatures, so plan for that on small VPS plans.

2. Linux Malware Detect (maldet)

Linux Malware Detect (LMD) by R-fx Networks focuses on the threats found on shared hosting servers: PHP shells, mailers and injected code. It uses its own signature set and can use ClamAV's engine for faster scanning.

maldet -a /var/www          # scan a folder
maldet --report list        # view reports
maldet -q SCANID            # quarantine hits from a scan

Best for: hosting servers with many websites. It installs a daily cron scan and can watch upload folders. Updates come less often than they used to, so treat it as one layer among several.

3. rkhunter and chkrootkit

These two tools look for rootkits, hidden files, modified system binaries and suspicious network listeners.

sudo apt install rkhunter chkrootkit
sudo rkhunter --propupd     # record a baseline on a clean system
sudo rkhunter --check --sk
sudo chkrootkit

Run --propupd right after installing on a server you know is clean, and again after every system update, otherwise rkhunter reports updated binaries as suspicious. Expect some false positives; investigate each warning rather than ignoring them all.

Lynis audit system results showing the hardening index, tests performed and components
A Lynis security audit

4. Lynis

Lynis is a security auditing tool rather than a malware scanner. It checks SSH, firewall, file permissions, installed packages, logging and more, and gives you a hardening score with specific suggestions.

sudo apt install lynis
sudo lynis audit system

Best for: finding the weaknesses that let malware in.

5. Imunify360 and ImunifyAV

Imunify360 from CloudLinux is a commercial security suite built for web hosting servers with cPanel, Plesk, DirectAdmin or standalone setups. It combines real-time malware scanning, automatic cleanup of infected files, a web application firewall, intrusion detection, and patching of vulnerable PHP versions and CMS installs. ImunifyAV is a free scanner-only version, and ImunifyAV+ adds automatic cleanup.

Best for: servers that host many customer sites, where real-time detection and one-click cleanup save hours of work.

6. Microsoft Defender on Windows Server

Windows Server 2016 and later include Microsoft Defender Antivirus, enabled by default. It provides real-time protection, cloud-delivered detection and automatic updates. Keep it on, and add exclusions only for paths your software vendor documents (for example SQL Server data files) to avoid performance problems. Check its status with:

Get-MpComputerStatus | Select AMServiceEnabled, RealTimeProtectionEnabled, AntivirusSignatureLastUpdated

Organisations can manage it centrally with Microsoft Defender for Endpoint.

7. Application-level protection for WordPress

Most infected websites are WordPress sites with outdated plugins. A security plugin such as Wordfence or Sucuri Security adds file-change detection, login protection and a firewall inside WordPress. Combine it with automatic updates for plugins and themes.

Prevention matters more than scanning

  • Keep the OS, PHP, web server, control panel and CMS updated.
  • Remove unused plugins, themes and old copies of sites.
  • Use SSH keys, disable root password login, and run Fail2ban.
  • Give each website its own system user so one hacked site cannot modify others.
  • Disable PHP execution in upload directories.
  • Take automatic, off-server backups so you can restore a clean copy quickly.

What to do if a server is infected

  1. Take a snapshot or backup of the current state for investigation.
  2. Scan with several tools, and check recently modified files: find /var/www -type f -mtime -3 -name "*.php".
  3. Remove malware, then update everything and change all passwords and keys.
  4. If a rootkit is found, do not trust the system: rebuild the server and restore clean data from backup.
Steps when a server is infected: isolate, find the entry point, clean or rebuild, change passwords, restore and monitor
If a server is infected

Frequently asked questions

Does a Linux server need antivirus?

A web server does. Linux itself is rarely infected through viruses, but websites, uploads and weak passwords let attackers place malware that scanners like ClamAV and maldet can find.

What is the best free antivirus for a Linux server?

ClamAV combined with Linux Malware Detect, plus rkhunter for rootkits and Lynis for auditing. ImunifyAV is a good free option on hosting panels.

Is Imunify360 worth it?

For servers hosting many sites, usually yes: real-time scanning, automatic cleanup and the web firewall save a lot of manual work. For a single site, the free tools plus good hardening are often enough.

Do I need extra antivirus on Windows Server?

Microsoft Defender Antivirus is built in and sufficient for most servers. Make sure it is enabled and updated, and avoid running two real-time antivirus products at once.

Nishant Kumar, Sr. Server Engineer at 99RDP
Written byNishant KumarSr. Server Engineer, 99RDP. Part of the team that runs our servers and answers support.
Keep reading

More VPS and Hosting guides

All VPS and Hosting guides

Need a server for this?

✓ Setup in minutes✓ Full admin access✓ 7-day refund on new services