2024年09月27日 建站教程
nginx设置禁止访问php的方法?下面web建站小编带大家了解一下实现方法!
配置nginx,禁止解析指定目录下的指定程序
server {
listen 80;
server_name www.dmtest.com;
location / {
root html;
index index.php index.html index.htm;
}
location ~ ^/images/.*\.(php|php5|sh|pl|py)$
{
deny all;
}
location ~ ^/static/.*\.(php|php5|sh|pl|py)$
{
deny all;
}
location ~ ^/data/(attachment|avatar).*\.(php|php5)$
{
deny all;
}
......
......
}
本文链接:http://so.lmcjl.com/news/14062/