xeno74 wrote: Thu May 28, 2020 12:14 pm
Apache part2:
Order allow,deny tells your web server that the Allow rules are processed before the Deny rules. If the client does not match the Allow rule or it does match the Deny rule, then the client will be denied access.
Order deny, allow means that the deny rules are processed before the allow rules. If the client does not match the deny rule or it does match the allow rule, then it will be granted access.
Examples:
Code: Select all
<Directory "/www">
Order Allow,Deny
Deny from all
Allow from all
</Directory>
In this case, your client would be denied access. Why? Because Apache first evaluates the Allow directive rules and then the Deny directive rules, so Allow from all would be executed first and then the Deny from all would take place.
Code: Select all
<Directory "/www">
Order Deny,Allow
Deny from all
Allow from all
</Directory>
The configuration above would result in your client being allowed access because the Deny from all rule would be processed first and the Allow from all rule would be processed second. Now, let's get more specific. The following example could be used for specialized and restricted servers, for example some kind of intranet site.
Code: Select all
<Directory "/www">
Order Deny,Allow
Deny from all
Allow from example.com
</Directory>
This is a bit expanded application of the Order directive. This configuration would restrict everyone from accessing the /www directory but hosts in the example.com domain. Abc.example.com would be allowed access,
www.myexample.com would be restricted. Now, let's say you want to do the opposite. You want to restrict someone from some specific domain (perhaps someone who is attacking your web site) and allow everyone else.
Code: Select all
<Directory "/www">
Order Allow,Deny
Allow from all
Deny from www.myexample.com
</Directory>
The configuration provided above would give access to everyone and restrict all hosts from the
www.myexample.com domain.