Skip to content
harry-suryapambagya
Back to blog

apache2-deny-rules

Quick reference for restricting access in Apache: the order/deny/allow syntax of 2.2 vs the Require syntax of 2.4 — almost the same problem, almost the same words, different config.

1 min read

Yesterday, I’ve had some task to make restriction to some web apps.

It’s use Apache2 as web service. Unfortunately, I bit confused about the restriction setup because I often used NGINX as web service.

Then, I knew that some syntax configuration are different even just between minor version.

# Apache 2.2
order deny,allow
allow from 12.34.5.67
allow from 98.76.54.32
deny from all
# Apache 2.4
Require ip 12.34.5.67
Require ip 98.76.54.32

Don’t forget about the required Apache modules. I will wrote about this later.

*also, the order syntax are different between deny,allow and allow,deny . smh.