How to set nginx upload directory without execution permission

WBOY
Release: 2023-05-19 08:55:05
forward
1138 people have browsed it

Copy code The code is as follows:



order allow,deny
deny from all

There is also the one on the Internet that does not have execution permissions for the nginx upload directory

Copy code The code is as follows:

location ~ ^/upload/.*\.(php|php5)$
{
deny all;
}

On the surface, there seems to be no problem with these configurations Yes, this can indeed be said under Windows.
But *nux is different. Everyone knows that the *nux operating system is case-sensitive. If you change it to an uppercase suffix name such as *.php, it will be bypassed.
Here I will talk about my personal experience. Solution:

Copy the code The code is as follows:


//? is a string matching .php as much as possible, i is not case-sensitive, and then the colon is followed by the regular expression
order allow,deny
deny from all
< ;/filesmatch>

The above means that all PHP files in the /var/www/upload directory are not case-sensitive and will be refused execution based on the order, allow, and deny principles. PHP files are also applicable to nginx
Another method, we have all used this

Copy code The code is as follows:


php_admin_flag engine off

In comparison, I am still optimistic about a method                                                        

The above is the detailed content of How to set nginx upload directory without execution permission. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!