Apache 2.4.33.

We have the followings in a config file:

<Directory "/var/spool/asterisk/monitorDONE">
        Options Indexes MultiViews
        AllowOverride None
        Require ip 118.x.x.x
        <files *.mp3>
                Forcetype application/forcedownload
        php_admin_value engine Off

To restrict multiple IPs if I put Require ip 118.x.x.x 103.x.x.x 116.x.x.x then when I try to restart the apache it fails and errors in the config file.

I also have tried the following format but did not work:

Require ip 118.x.x.x
Require ip 103.x.x.x
Require ip 116.x.x.x

To allow specific IP addresses to access the site you should have:

  Require ip 118.x.x.x
  Require ip 103.x.x.x
  Require ip 116.x.x.x

A little more info you can find in Apache documentation here: https://httpd.apache.org/docs/2.4/howto/access.html I have in mind this:

The Require provides a variety of different ways to allow or deny access to resources. In conjunction with the RequireAll, RequireAny, and RequireNone directives, these requirements may be combined in arbitrarily complex ways, to enforce whatever your access policy happens to be.

  • That is strange! I tried that before and it did not work. But now it is working. Must have missed something critical. – Rahatur Oct 15 '20 at 11:35
  • Any idea why one of the IP works but others don't? I had checked the IPs from google which gives the face IPs. – Rahatur Oct 18 '20 at 17:56
  • Did you use <RequireAny> block with "Require ip" directives? – mariaczi Oct 19 '20 at 8:26
  • Yes, AllowOverride None followed by <RequireAny>. – Rahatur Oct 20 '20 at 9:24
  • Any others rules on firewall? – mariaczi Oct 20 '20 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.