Access Control Apache2

Access control Apache2 version 2.4 slightly different from 2.2, for example, to allow access to all, in version 2.4 you need to specify:

Require all granted

Allow access to the specified IP addresses:

Require local
Require ip 192.168.56.1 192.168.22.10

Allow all but the specified IP:

Require all granted
Require not ip 192.168.56.1

Allow the specified host:

Require host example.com

Prohibit all:

Require all denied

And in the version of Apache2 2.2, permit everyone access like this:

Order allow,deny
Allow from all

Prohibit all:

Order deny,allow
Deny from all

Allow access by specified IP:

Order allow,deny
Allow from 192.168.56.1 192.168.22.10

Allow the specified host:

Order Deny,Allow
Deny from all
Allow from example.com

After the changes in the Apache2 configuration, a reboot is required (if the changes were in the .htaccess file, then the reboot is not required):

sudo service apache2 restart

See also:
Using .htaccess

Leave a comment

Leave a Reply