How to block server access via IP (most attacks target IP, circumventing Cloudflare)

I would like to disable access to my server via IP. So if someone tries to access my server by its IP, they should be blocked (or rerouted to the URL.)

What I am trying to achieve is block all of the attacks that use my IP instead of an URL. No legit visitor does that and it allows attackers to avoid Cloudflare and any blocking rules.

I found this on the web but it doesn't look right, or does it?

ServerName Redirect 403 / ErrorDocument 403 "No" DocumentRoot /dev/null/

Closed (works as designed)


Ilia's picture
Submitted by Ilia on Mon, 01/20/2020 - 05:52


Unfortunately, configurations such as that are a bit outside the scope of our support. That's not really a Virtualmin issue, and isn't something we'd be able to assist with here in the support tracker.

You're of course more than welcome to ask about that in the Forums! There's many wonderful folks there, and some may have tried a similar setup.