Home > Backend Development > PHP Tutorial > nginx如何禁止文件上传目录执行PHP

nginx如何禁止文件上传目录执行PHP

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:32:00
Original
1476 people have browsed it

/1/userheadimg_files
为图像等文件上传文件夹,如何禁止这个目录下的PHP文件等被解析执行。

可能表述的不清楚.

回复内容:

/1/userheadimg_files
为图像等文件上传文件夹,如何禁止这个目录下的PHP文件等被解析执行。

可能表述的不清楚.

<code>location ~ \/1\/userheadimg_files\/.*\.php {
    deny all;
}
</code>
Copy after login

<code>location ^~ /1/userheadimg_files {
    deny all;
}
</code>
Copy after login

<code>location ~ /upload/.*\.php$ { deny all; } 禁止访问/upload下的PHP文件.
或者
location ~ \.php$ {} 中加入 if ($uri !~ "^/upload/") { fastcgi_pass 127.0.0.1:9000; } 不解析/upload下的PHP文件.
</code>
Copy after login
Related labels:
source:php.cn
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template