How to configure nginx to prohibit directory execution of php files

王林
Release: 2020-08-11 15:44:56
Original
3564 people have browsed it

How to configure nginx to prohibit directory execution of php files: [location ~ /dir/.*.(php|php5)?$ {deny all;}]. After the configuration is completed, the web service needs to be restarted.

How to configure nginx to prohibit directory execution of php files

Prohibit dir directory execution php file permissions

(Recommended tutorial: nginx tutorial)

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

Multiple directories

(Learning video recommendation: php video tutorial)

Prohibit dir and upload directories from executing php file permissions

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

After the configuration is complete, restart the web service.

The above is the detailed content of How to configure nginx to prohibit directory execution of php files. 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!