1

I recently installed MaxMind's MaxMindDB apache module successfully.

I added a new file called geoip.conf to /etc/httpd/conf.d/ with the following contents:

<IfModule mod_maxminddb.c>
    MaxMindDBEnable On
    MaxMindDBFile COUNTRY_DB /some/dir/GeoLite2-Country.mmdb
    MaxMindDBEnv MM_COUNTRY COUNTRY_DB/country/iso_code

    SetEnvIf MM_COUNTRY US AllowUS
    Deny from all
    Allow from env=AllowUS
</IfModule>

When running apachectl -t I get the following error:

Syntax error on line 11 of /etc/httpd/conf.d/geoip.conf:
deny not allowed here

When I commented out the "Deny from all" line I got a similar error stating that allow not allowed here

I was unable to find anything online as this module has little documentation. Does anyone know how to fix this?

mittelmania
  • 209
  • 2
  • 10
  • #Geo Restrict MaxMindDBEnable On # MaxMindDBFile DB /path/to/GeoIP/GeoLite2-Country.mmdb MaxMindDBFile DB /root/GeoIP/GeoIP.dat MaxMindDBEnv MM_COUNTRY_CODE DB/country/iso_code SetEnvIf MM_COUNTRY_CODE ^(RU|DE|FR|US|CN) BlockCountry Deny from env=BlockCountry How to enable this module – Ashish Karpe Nov 18 '15 at 13:02

1 Answers1

2

This is simply because your Deny and Allow need to be applied within a container, either a <Directory>, <Files> or <Location> section.

bodgit
  • 4,661
  • 13
  • 26