Apache's access control refers to any way of access control of any resource.
First, host or IP address based control
This access control is based on the visitor's host name or IP address, by using the Deny and Allow instructions to allow or prohibit access to a host Our server resources. Usually the Order directive is also used together to define the order in which the Deny and Allows directives work. If you do not use the Order directive, the default order is Deny, Allow, which is equivalent to Order Deny, Allow.
The Order directive works in conjunction with the Allow, Deny directive to implement a three-step control system.
Step 1: According to the order of the Order, apply all the Allow commands or Deny commands in the order to the current request; that is, if it is Order allow, deny, then the first step is to put all the The Allow directive is applied to the current access, if there is a match, then the access is allowed; if there is no match to an Allow directive, then access is prohibited;
Step 2: All the remaining instructions are all The statement matches the current request, and if there is a match, the corresponding access control is executed;
Step 3: If the current request does not match any of the first two steps, the next instruction in the Order instruction is executed.
Below, an example to understand:
Make the resources in the specified directory only local access
<Directory "/server"> Order allow, deny Allow from 127.0.0.1 </Directory> Step 1: The local access matches the Allow from 127.0.0.1 command, so it is allowed; other hosts do not match any of the Allow commands, so access is forbidden;Step 2: All accesses do not match the Deny instruction;
Step 3: There is no access to any instruction, that is, it is not a local access. Follow the Order instruction to execute the following deny instructions. Therefore, access is forbidden;
Second, access control according to environment variables
This method can be implemented by Allow from env= or Deny from env= syntax, for example, only Firefox browser is allowed. Customer Access:
<Directory "/server"> SetEnvIf User-Agent "Firefox" ff=1 Order allow,deny Allow from env=ff </Directory> Access control with mod_rewriteWith the [F] flag of the mod_rewrite directive, access control can be implemented on a resource based on any criteria.
For example, I want to access any resource from 8 am to 6 pm, I can do this:
RewriteEngine OnRewriteCond %{TIME_HOUR} >20 [OR]RewriteCond %{ TIME_HOUR} <07RewriteRule ^/fridge - [F] In this case, it will return to 403 after 8:00 in the evening until 7 am.
Yesterday, Ctrip.com couldnt open the server. I believe that everyone can see the spectacula
Today, I still need to use a super good chassis to assemble a large-capacity server —
Reducing keyboard input can greatly improve the productivity of programmers. The use of sho
Experimental software environment: virtual machine Vmware Workstation10.0, CentOS 6.5 32 bit 1, auto
About Apache server access control
Five ways to cool the blade server
There are networks in the network security defense
Blade server hard disk boot Linux stand-alone installation (1)
Solution for Flv file cannot be played under the server in 2003.
The server must know a few knowledge
Xeon processor IBM System x3500 priced at 14300
Brief introduction to server performance testing tools
Simple two strokes to achieve the left side of the IE 9 Favorites
What should I do if Win7 does not maximize the window every time I open it?
In the hot summer, 11 coups will help your data center cool down and reduce costs.
Win8.1 task manager becomes gray and can't start solution
About 4000 computer to recommend online games on the line, no money
QQ under Win7 can not start prompt configuration incorrect processing skills
Win8.1 upgrade win10 encountered modern setup host stop working how to do