Apache,nginx upload directory do not have permission to set the method _linux

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.