It is forbidden to upload directory to execute php script under linux

王林
Release: 2020-04-25 10:39:53
Original
3038 people have browsed it

It is forbidden to upload directory to execute php script under linux

Can be achieved by modifying the nginx.conf configuration file.

The method is as follows:

Disable single directory:

location ~* ^/attachments/.*.(php|php5)$ {
deny all;
}
Copy after login

(Video tutorial recommendation: linux video tutorial)

Prohibit multiple directories :

location ~* ^/(attachments|upload)/.*.(php|php5)$ {
deny all;
}
Copy after login

Note:

1. The above configuration file code needs to be placed above location ~ .php{...}. If placed below, it will be invalid.

2. Attachments need to write relative paths, not absolute paths.

3. Don’t forget to restart nginx

service nginx restart
Copy after login

Recommended tutorial: linux tutorial

The above is the detailed content of It is forbidden to upload directory to execute php script under linux. For more information, please follow other related articles on the PHP Chinese website!

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
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!