The Apache Haus Forum

Forum Topics => Apache 2.4 => Topic started by: mario on July 09, 2011, 02:24:53 PM

Title: Convert rules from 2.2 to 2.4
Post by: mario on July 09, 2011, 02:24:53 PM
I try migrate my config rules to the new 2.4 config.

Before it was

Code: [Select]
Order Allow,Deny
Allow from all
Deny from 212.100.100.100

The one I tried is
Code: [Select]
Require all granted
Require not ip 212.100.100.100

but than I get this warning
Quote
../../bin/httpd -S
Syntax error on line 9 of /opt/apache2/conf/vhosts/main.conf:
negative Require directive has no effect in <RequireAny> directive
httpd (pid 5319) already running

 ??? How do I make this work?
Title: Re: Convert rules from 2.2 to 2.4
Post by: Gregg on July 09, 2011, 09:51:01 PM
This is the one thing I do not like as it currently stands, you can not use "not" everywhere, especially in with Require ip, I banged my head for some time trying to figure it out myself.

<RequireNone>
Require ip 212.100.100.100
</RequireNone>

I think that is what I did get working properly

see http://httpd.apache.org/docs/trunk/mod/mod_authz_core.html#require from Require and the next few below it, RequireAll/Any/None
Title: Re: Convert rules from 2.2 to 2.4
Post by: mario on July 09, 2011, 10:32:47 PM
Thanks for the hint. That didn't work for me some kinda, but with some trial this works for me.

Code: [Select]
<RequireAll>
Require all granted
Require not ip 212.100.100.100
</RequireAll>

This is nearly the same as with the Allow / Deny stuff.