Home >Operation and Maintenance >Nginx >How to configure nginx to prohibit directory execution of php files

How to configure nginx to prohibit directory execution of php files

王林
王林Original
2020-08-11 15:44:563632browse

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;
}

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;
}

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!

Statement:
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