Let's take a look at two paragraphs. Typically, you do not have permissions on the upload directory, configured as follows:
Copy Code code as follows:
<directory "/var/www/upload" >
<filesmatch ". php" >
Order Allow,deny
Deny from all
</FilesMatch>
</Directory>
and the online nginx upload directory without permission to execute
Copy Code code as follows:
Location ~ ^/upload/.*\. (PHP|PHP5) $
{
Deny all;
}
These configurations seem to have no problem on the surface, and they do say so under Windows.
But *nux is different, we all know the *nux operating system is case-sensitive, and if you replace it with the uppercase suffix *.php it bypasss.
Here I say my personal solution:
Copy Code code as follows:
<directory "/var/www/upload" >
<filesmatch "(? i:.php)" >//? is as many matches as possible. PHP string, I is case-insensitive, then the colon follows the regular expression
Order Allow,deny
Deny from all
</FilesMatch>
</Directory>
The above means that all PHP files in the/var/www/upload directory is not case-sensitive, through the order,allow,deny principle of the refusal to execute PHP file, the Nginx is also applicable
Note: st0p wrote the article specifically for this regular usage, for this is not understood can be referred to
Http://www.jb51.net/article/25673.htm
Another way, we've all used it.
Copy Code code as follows:
<directory "/var/www/upload" >
Php_admin_flag engine off
</Directory>
By contrast, I'm a good way to be optimistic.