logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: mod_evasive question
Author
sambache



Joined: 11 Feb 2014
Posts: 21
Location: Canada, Yorkton, Sk

PostPosted: Thu 26 Nov '26 5:32    Post subject: mod_evasive question Reply with quote

running Apache with some vhosts directly and a few vhosts as reverse proxy for some domains I am not sure where to place the mod_evasive configuration.

Is it ok to place the mod_evasive configuration in httpd.conf or is it better to place it in each vhost?

Also, if placing it in the vhost of the reverse proxy domain, is mod_evasive applied or is this only applied to vhosts hosted on Apache?

This is all new to me and I am a bit lost here.
A bit of advise would help a lot.

Thank you
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 478
Location: UK

PostPosted: Sat 28 Nov '26 22:19    Post subject: Reply with quote

Nobody's chosen to reply to this request to date, so...

I've no personal experience of using mod_evasive in anger, but regarding your concerns, the module documentation provides guidance.

Notably, mod_evasive operates on a connection basis, so assuming your vhosts are all listening on the same port, then a global level configuration would be appropriate, rather than duplicating settings in each <VirtualHost>.

There are two reasons:

1. mod_evasive is designed to detect and mitigate request patterns from a given client (such as repeated requests or excessive concurrent requests).
2. With multiple virtual hosts, you generally want consistent protection across all hosted sites, rather than independent per-vhost policies.

There is an important distinction between Apache's global configuration scope and how mod_evasive actually tracks requests. The documentation (README.md) explicitly supports both approaches:

- Global configuration enables it across all virtual hosts.
- Configuration inside a <VirtualHost> enables it selectively for that vhost.

These are the recommended defaults for the Apache configuration, outside all vhost sections:
Code:
<IfModule mod_evasive24.c>
    DOSEnabled On
    DOSHashTableSize 3097
    DOSPageCount 2
    DOSSiteCount 50
    DOSPageInterval 1
    DOSSiteInterval 1
    DOSBlockingPeriod 10
</IfModule>

If necessary, adjust the thresholds to suit your traffic.

One important consideration relating to reverse proxies, which is arguably more important than the global-versus-vhost question.

If Apache sits behind a reverse proxy or load balancer, make sure it sees the actual client IP address rather than the proxy's IP address.

Otherwise, mod_evasive will see all incoming requests as originating from the same proxy IP and potentially block legitimate users together.

If you're using mod_remoteip, check your configuration and ensure that:

- RemoteIPHeader is configured for the header supplied by your trusted proxy.
- RemoteIPTrustedProxy or RemoteIPInternalProxy identifies trusted proxy addresses.
- The proxy overwrites the client-IP header rather than trusting arbitrary incoming values.

My view: Use global mod_evasive configuration, with correctly configured client-IP handling. This gives you consistent protection across all your vhosts without maintaining duplicate configurations.
Back to top
sambache



Joined: 11 Feb 2014
Posts: 21
Location: Canada, Yorkton, Sk

PostPosted: Sun 29 Nov '26 19:27    Post subject: Reply with quote

Thank you tangent for the detailed info.
The module is loaded and I had setup my configuration similiar as mentioned and have it right now as global setting.

My Apache is the reverse proxy which will forward requests to my backend server which is still my old Sambar server.

I now have to find out the logformat from Apache which is readable by the Sambar.

In one "test vhost" I have added

Code:
RemoteIPHeader   Client-ip
RemoteIPHeader   X-Forwarded-For
RemoteIPInternalProxy   "ip of apache reverse proxy machine"


This will be a little bit of fiddling & testing.
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3221
Location: Hilversum, NL, EU

PostPosted: Sun 29 Nov '26 21:57    Post subject: Reply with quote

Wow… you are still running Sambar.
It was a all-in-server,
Was a very good server, pity that Tod stopped.

Back then I had sambarserver.info forum.
I switched to Apache and started Apachelounge.

I am also still using Sambar (Apache reverse proxy)
for some tasks.

Cheer, Steffen

A lot of servers :
Servers Users Online
DHCP [ on / OFF ] Help
DNS [ on / OFF ] Help Security
FTP [ on / OFF ] Help Security
HTTP [ ON ] Help Mappings mime.ini Security
MAX POST: 5-MB (unauthed) 25-MB (authed user)
1 of 25 Users
WebDAV [ on / OFF ] Help Highly Recommended!
IM [ on / OFF ] Security
IM S2S [ OFF ]
IRC [ on / OFF ] Help Security
Mail [ on / OFF ] Help Security
Syslog [ on / OFF ] Help Security
Telnet [ on / OFF ] Help
TFTP [ on / OFF ] Help Security

Proxies
Bridge [ on / OFF ] Help Security
FTP [ on / OFF ] Security
HTTP [ on / OFF ] Help Security
IMAP4 [ on / OFF ] Security
NNTP [ on / OFF ] Security
POP3 [ on / OFF ] Security
Reverse Proxies [ on / OFF ] Help Security
SMTP [ on / OFF ] Security
SOCKS [ on / OFF ] Help Security
Pass-thru Proxies
Back to top
sambache



Joined: 11 Feb 2014
Posts: 21
Location: Canada, Yorkton, Sk

PostPosted: Sun 29 Nov '26 23:06    Post subject: Reply with quote

Hi Steffen,

yes I still use the Sambar and still love it.

Apache is my reverse proxy with some hosted vhosts and use it as SSL Reverse proxy for the sambar sites. Works perfectly including automatically creating new Certs using certbot.

As you have a similiar setup, I am trying to get the original client IPs into Sambar's logs. In Sambar I have set the logging to "Custom log" style. Just have to test out the correct formatting to get Apache & Sambar to work together.

Any hints or tips?
Do I have the Apache settings correct?

Johannes
Back to top


Reply to topic   Topic: mod_evasive question View previous topic :: View next topic
Post new topic   Forum Index -> Apache